Using Excel COUNTIF function with dates
If you want to count cells with dates that are greater than, less than or equal to the date you specify or date in another cell, you proceed in the already familiar way using formulas similar to the ones we discussed a moment ago. All of the above formulas work for dates as well as for numbers. Let me give you just a few examples:
Criteria
Formula Example
Description
Count dates equal to the specified date.
=COUNTIF(B2:B10,"6/1/2014")
Counts the number of cells in the range B2:B10 with the date 1-Jun-2014.
Count dates greater than or equal to another date.
=COUNTIF(B2:B10,">=6/1/2014")
Count the number of cells in the range B2:B10 with a date greater than or equal to 6/1/2014.
Count dates greater than or equal to a date in another cell, minus x days.
=COUNTIF(B2:B10,">="&B2-"7")
Count the number of cells in the range B2:B10 with a date greater than or equal to the date in B2 minus 7 days.
Apart from these common usages, you can utilize the COUNTIF function in conjunction with specific Excel Date and Time functions such as TODAY() to count cells based on the current date.
Criteria
Formula Example
Count dates equal to the current date.
=COUNTIF(A2:A10,TODAY())
Count dates prior to the current date, i.e. less than today.
=COUNTIF(A2:A10,"<"&TODAY())
Count dates after the current date, i.e. greater than today.
=COUNTIF(A2:A10,">"&TODAY())
Count dates that are due in a week.
=COUNTIF(A2:A10,"="&TODAY()+7)
Count dates in a specific date range.
=COUNTIF(B2:B10, ">=6/7/2014")-COUNTIF(B2:B10, ">6/1/2014")