The first Countif counts the number of dates in the given range greater than the 'start date'. The second Countif subtracts any date greater than the 'end date'.
"I need is to search for the number of times any date in a given period occurs i.e. number of 03/07/07s in a period"
where "period" becomes a range (A1:A9) is:
To use the UDF below, enter
in a cell. Then select the range (or type it in) then a comma ie:
Now either select a cell that has the start date or enter a date in quotes and a comma ie:
Then finish up with another range or quoted date and a final parentheses:
VB: AutoLinked keywords will cause extra spaces before keywords. Extra spacing is NOT transferred when copy/pasting, but IS if the keyword uses "quotes".
Function DCnt(rng As Range, sdate As Date, edate As Date)
Dim Cel As Range
Dim Countr As Long
For Each Cel In rng
If Cel > sdate And Cel < edate Then
Countr = Countr + 1
DCnt = Countr