Compare Dates in Excel

Last Updated :

-

Edited by :

Reviewed by :

Table Of Contents

arrow

Comparing Two Dates in Excel

Comparing two dates in Excel could be different from one scenario to another. Sometimes, we may need to compare whether one date is equal to the other, and sometimes we may need to check whether one date is above or below a certain date. Often times we may need to arrive based on testing all the mentioned criteria, like this, it varies from scenario to scenario. We will see each one of them with practical examples.

Compare-Dates-in-Excel

How to Compare Two Dates in Excel?

Given below are some examples to compare two dates in Excel.

#1 - Compare If Two Dates are Equal or Not

Example #1

Comparing whether the date is equal to the other or not is simple; we will have two dates, and we need to check whether that cell date is equal to the other.

Follow the steps to compare two dates in Excel.

  1. Look at the below data to compare dates in Excel.


    Compare Date in Excel - Example 1.1

  2. Now in cell C2, apply the formula as =A2=B2.


    Compare Date in Excel - Example 1.2

  3. Press Enter to get the result.


    Compare Date in Excel - Example 1.3
    We have the same date in both columns, so we got TRUE as a result.

  4. Drag the formula to the following columns as well to get the result.


    Compare Dates Output 1

So, wherever data is matched, we have the result as TRUE, and wherever data is not matched, we have the result as FALSE.

One interesting fact about this example is row number 7; in this row first date is written as “29-Oct-2019,” but the second date is written as 43767. Even though both are different, the result is still TRUE, i.e., both are the same.

I have told date & time are sensitive things in excel at the beginning because of this kind of scenario in Excel. When we apply the date format “DD-MMM-YYYY” to serial number 43767, we will get the same result as the A7 cell.

Compare Date in Excel - Example 1.4

So, excel reads them as serial numbers, not as dates. Like this, we can compare two dates in excel.

Example #2

Now assume you don’t want to see default results of TRUE or FALSE rather, you may want to have a different result like “Both are Correct” if both the dates are matching, or else you need a result like “Both are Not Correct.” So this is done by using the logical function “IF.”

  • Open the IF function in Excel in the “MATCH” column.
Compare Date in Excel - Example 2.1
  • The first criterion of the formula is a logical test in Excel, so in this case, our logical test is to check whether “Date 1” is equal to “Date 2” or not, so apply the logical test as E2 = F2.
Compare Date in Excel - Example 2.2
  • The next argument is value if true; this is nothing if the applied logical test is TRUE, i.e., if “Date 1” is equal to “Date 2,” what is the value needed? So, we need the value as “Both are Correct.”
Compare Date in Excel - Example 2.3
  • The next argument is value if false, so if the logical test is incorrect, then what is the value needed? We need the values as “Both are Not Correct.”
Example 2.4

Ok, we are done with the formula; close the bracket and hit the enter key to get the result.

Example 2.5

Drag the formula to other cells.

Compare Dates - Output 2

So, the results are here instead of default TRUE or FALSE.

#2 - Compare If the Date is Greater or Smaller

We have seen one set of calculations; now, we will see whether one date is greater than or lower than another. For this, look at the below example data.

Example 3.1

First, we will check “Date 1” is greater than “Date 2” or not as follows.

Example 3.2

There you go, we have results.

Similarly, we just need to change the logical operator in Excel from greater than symbol to less than symbol to do the other way around the calculation.

Example 3.3

Like this, we can compare dates in Excel. However, there are certain things you need to keep in mind about this.

Things to Remember

  • The date is stored as serial numbers, so you must be aware of it.
  • There is a situation date is stored as a text value in such cases, date-looking values are not dates, so you need to convert them to date.