Forum Discussion
Formula help - why doesn't this work for January dates please?
A few things can cause MONTH() to return unexpected results, but there is one very common cause specifically for January.
The formula only works correctly if every value in the two ranges is a real Excel date.
If any cell contains:
- text that looks like a date,
- a blank that Excel interprets as 0,
- a zero value,
- or anything non-date,
then:
MONTH(0) returns 1
…which Excel interprets as January.
So any blank or invalid date will be counted as January — giving you an incorrect total.
In one formula:
=SUMPRODUCT((ISNUMBER('Andy''s Team'!E2:E32))*(MONTH('Andy''s Team'!E2:E32)=12)
+(ISNUMBER('Andy''s Team'!H2:H32))*(MONTH('Andy''s Team'!H2:H32)=12))
This counts only real dates and ignores blanks/text.
I hope it helps them.
I'm sorry, but formula doesn't ignore texts. ISNUMBER(text) returns zero, but MONTH(text) returns #VALUE!. If multiply zero on (#VALUE!=12) result will be #VALUE!, and SUMPRODUCT with at least one element with error also returns an error.