Home > Enterprise >  Month function within Sumif function
Month function within Sumif function

Time:01-19

When I have entered this formula in a cell and press Enter, Excel doesn't accept it.

=SUMIF(MONTH($B$2:$B$61);K2;$A$2:$A$61)

Why?

enter image description here

enter image description here

CodePudding user response:

SUMIF expects a range. It doesn't want an array of values, it wants a qualified range. Adding MONTH() around the range turns it into an array of values.

You can see that within VBA, it's explicit as to what it expects.

SUMIF

That's my take on it ...!

CodePudding user response:

The problem is that you cannot put MONTH inside of SUMIF. You can replace it with:

=SUM((MONTH($B$2:$B$61)=K2)*$A$2:$A$61)

CodePudding user response:

Your column C holds the month number, you can use that as criteria range instead of MONTH($B$2:$B$61)

Try =SUMIF(MONTH($C$2:$C$61);K2;$A$2:$A$61)

  •  Tags:  
  • Related