Count cells with dates

E

Evgenia

Hi,

Please help with the formulae, I need to COUNT cells that contain date
(dd/mm/yyyy).

Your help is appreciated.
 
B

Bob Phillips

Hi Barb,

That doesn't work in the UK. You should use date independent formulae such
as

=COUNTIF(A1:A15,DATE(2005,11,21))

or

=COUNTIF(A1:A15,--"2005-11-21")

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
E

Evgenia

Thanks,
but i need to count cells that contain any date, not only a specific
one.
Can you help with that?
 
B

Bob Phillips

You need a UDF

Function CountDates(rng As Range)
Dim cell As Range
For Each cell In rng
If IsDate(cell.Value) Then
CountDates = CountDates + 1
End If
Next cell
End Function

=CountDates(A1:A15)

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Top