No, you can't do that, COUNTIF
function requires a range as first argument - any operation on a range (like using MONTH
function) converts that range to an array that COUNTIF
doesn't accept
Possible alternative are to use SUMPRODUCT
e.g.
=SUMPRODUCT((MONTH(range)=5)+0)
or COUNTIFS
like this
=COUNTIFS(range,">="&Z1,range,"<"&EOMONTH(Z1,0)+1)
where Z1 is 1st of the month to count, e.g. 1-May-2013
Of course the SUMPRODUCT version doesn't take account of the year (although you could add that in) while COUNTIFS does
Explanation
In SUMPRODUCT
when you use an expression like MONTH(range)=5
that returns an "array" of TRUE/FALSE
values like {TRUE;FALSE;FALSE;TRUE}
....but SUMPRODUCT
here only sums numbers so we need a way to "co-erce" TRUE to 1 and FALSE to 0. You can do that with any mathematical operation that doesn't change the value, e.g. +0, *1 or you can add -- to the front like this:
=SUMPRODUCT(--(MONTH(range)=5))
so we get something like
=SUMPRODUCT(--({TRUE;FALSE;FALSE;TRUE}))
...and that becomes
=SUMPRODUCT({1;0;0;1})
and then SUMPRODUCT sums those values to get 2, i.e. the number of dates in May.
SUMPRODUCT is preferred to SUM
purely because you don't need to "array enter" the formula with CTRL+SHIFT+ENTER
See here for a good explanation of SUMPRODUCT and it's many uses