How to Use Countif with Dates in Excel

COUNTIF is a very useful Excel function that counts the number of times cells that have some common parameter appear in a range.

It has two parameters:

  1. The range in which cells are found and;
  2. Criteria based on which we want to count the cells.

In the text below, we are going to show how to use this function when we have dates in our range.

Countif with Dates

For our example, we will use a filled questionnaire from a person that is traveling abroad (to Spain):

A picture containing diagram

Description automatically generated

Now, if we want to know how many cells we have that contain a date, we will use the following formula:

Our count will be as follows:

Graphical user interface, application, table, Excel

Description automatically generated

Which is the correct result of the dates we have in our range.

To simply explain how this formula works, we need to understand that Excel observes all dates as numbers. Number 1 indicates the date 1/1/1900. This date is the oldest date that we can have. So with this formula, we cover all the dates bigger than this one, which is every possible date.

There is, sadly, a downside to this formula. In all cells in column B, we only have the dates as numbers, since the passport number has the letter “B” in it. If we delete the letter “B”, we will get the following result of our COUNTIF formula:

Graphical user interface, application, table, Excel

Description automatically generated

Now we have the number 4, which means Excel recognized four values that are bigger than number 1 in our range.

Sadly, there is no workaround for this issue. So this can serve as a good warning. If you have a combination of numbers and dates, Excel will always observe them as equal, as dates are simply numbers in a different format.

Countif in a Combination with Isnumber

We can also use a COUNTIF formula in a combination with the ISNUMBER function to count the number of dates in our range.

For this purpose, we will create another sheet with traveling info data:

Table

Description automatically generated with medium confidence

We have the passport number with the letter „B“ which means that this will not be included in our formula.

ISNUMBER is a simple Excel formula that checks if a value in our desired cell refers to a number or not. If it is a number, then it returns the value TRUE. If not, it returns FALSE.

The formula in cell B1 will be:

We will drag this formula till the end of our table (cell B8) and will have the following results:

Table

Description automatically generated with medium confidence

Now we will count only those values that are true, and the formula in cell B9 will be:

The result will be number 3, as we could have guessed:

Graphical user interface, application, table, Excel

Description automatically generated

Tomasz Decker is an Excel specialist, skilled in data analysis and financial modeling.