COUNTIF function with date range

A

Amy

Is there anyway to use the COUNTIF function with a date
range. I'm trying to count each date within a particular
month. For example,

=COUNTIF(G5:G100, "12/**/03"

And this example with the wildcards is currently not
working.

Thanks. Amy
 
P

Peo Sjoblom

=SUMPRODUCT(--(MONTH(G5:G100)=12),--(YEAR(G5:G100)=2003))

or

=COUNTIF(G5:G100,">="&DATE(2003,12,1))-COUNTIF(G5:G100,">"&DATE(2003,12,31))

--
For everyone's benefit keep the discussion in the newsgroup.

Regards,

Peo Sjoblom
 
P

Peo Sjoblom

There are 2 problems with this method, one is that if there are other years
with
December dates involved and if there are blanks,

=SUMPRODUCT(--(MONTH(G5:G100)=1))

will count blank cells as January dates


--
For everyone's benefit keep the discussion in the newsgroup.

Regards,

Peo Sjoblom
 
D

Domenic

Hi Peo,

Peo Sjoblom said:
if there are blanks,

=SUMPRODUCT(--(MONTH(G5:G100)=1))

will count blank cells as January dates

Didn't realize it, since I usually use both month and year. Thanks for
bringing this to my attention.
 
Top