How to Compare Two Dates in Excel (Formula)

Last Updated: March 24, 2024
puneet-gogia-excel-champs

- Written by Puneet

In Excel, you can compare two dates by using a simple and quick formula that can return TRUE or FALSE in the result. Or you can also use the IF function to get the custom message in the result while comparing two dates.

In the following example, we have two different dates in cells A1 and B1.

compare-two-dates

You can use the following steps:

  1. First, enter the “=” equal sign in cell C1.
  2. Now refer to cell A1 where you have the first date.
  3. Next, enter the “=” equal sign again.
  4. After that, refer to cell B1 where you have the second date.
  5. In the end, hit enter.
=A1=B1
formula-to-compare-dates

Further in this tutorial, we are going to look at a few different examples to understand it.

Compare IF a Date is Greater than Another Date

In the following example, we have compared the first date with the second, if the first date is greater than the second date.

=A1>B1
compare-greater-date

In the formula, we have used the greater than operator to do this.

Compare a Date with Today’s Date

In the same way, if you want to compare a date with today’s date you can use the TODAY function. In the following example, we have used the TODAY function and then compare it to another date.

compare-date-with-today
=A5=TODAY()

Get the Excel File