View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Countif with dates for vs 2003

How about:

=COUNTIF(Data!F2:F65536,"=date(2008,1,1))
-COUNTIF(Data!F2:F65536,"<=date(2008,1,31))

Or
=COUNTIF(Data!F:F,"=date(2008,1,1))
-COUNTIF(Data!F:F,"<=date(2008,1,31))

(I bet you don't have a date in F1)

=SUMPRODUCT(--(MONTH(Data!F2:F65536)=1),--(YEAR(Data!F2:F65536)=2008))
or
=SUMPRODUCT(text(Data!F2:F65536,"yyyymm")="200801" )

Adjust the ranges to match--but you can't use whole columns (except in xl2007).

=sumproduct() likes to work with numbers. The -- stuff changes trues and falses
to 1's and 0's.

Bob Phillips explains =sumproduct() in much more detail he
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

And J.E. McGimpsey has some notes at:
http://mcgimpsey.com/excel/formulae/doubleneg.html


Kay wrote:

Hello all,

I have looked through the archives and have seen several formulas that
should work in my spreadsheet, but return either a 0 or the wrong number.
The dates are entered using 1/6/08 and formatted to appear as Jan-08. I want
to count the number of cells that have Jan as a date, etc.

I have tried the following:
=COUNTIF(Data!F2:F65536,"=1/1/2008") -COUNTIF(Data!F2:F65536,"<=1/31/2008")
The result counts all cells rather than the 50 it should be

=SUM(COUNTIF(F2:F65536,{"12/31/08","<=1/1/09"})) the result is 0

=SUMPRODUCT((MONTH(Data!F2:F65536)=1),(YEAR(Data!F 2:F65536)=2008)) the
result is 0

I am stumped.

Would really appreciate the help!


--

Dave Peterson