WeAreOne
WeAreOne

Reputation: 1343

Month function within Sumif function

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

Upvotes: 0

Views: 1939

Answers (3)

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)

Upvotes: 2

mark fitzpatrick
mark fitzpatrick

Reputation: 3310

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)

Upvotes: 2

Skin
Skin

Reputation: 11197

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 ...!

Upvotes: 2

Related Questions