View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gav123 Gav123 is offline
external usenet poster
 
Posts: 136
Default Array Function to Evaluate Dates

Thanks Ron..

Everyday there is an opportunity to learn something new..

Gav.

"Ron Rosenfeld" wrote:

On Tue, 15 Apr 2008 06:31:01 -0700, Gav123
wrote:

Hi,

Maybe this might help..

=COUNTIF(A2:A20,"=01/01/2008")-COUNTIF(A2:A20,"=01/02/2008")

This will return the number of dates for the range in January 2008

The dates in the formula are in DD/MM/YYYY format.

Hope this helps

Gav.


That formula will only work, as posted, if the OP's Windows Regional settings
are also in dd/mm/yyyy format.

Much better would be to use an unambiguous method of representing the date.
Either enter the date in cells, and refer to the cells, or use the DATE
function.

e.g.

With start date in A1 and end date in A2:

=COUNTIF(B:B,"="&A1)-COUNTIF(B:B,""&A2)

or

=COUNTIF(B:B,"="&DATE(2008,1,1))-COUNTIF(B:B,""&DATE(2008,1,31))


With any date in a month in A1, to get all the dates in that month:

=COUNTIF(B:B,"="&A1-DAY(A1)+1)-COUNTIF(B:B,""&A1-DAY(A1)+32-DAY(A1-DAY(A1)+32))
--ron