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 or not, sometimes we may need to check one date is above a certain date or below the certain date, and often times we may need to arrive based on testing all the mentioned criteria’s, like this it varies from scenario to scenarios. We will see each one of them with practical examples.

You are free to use this image on you website, templates, etc., Please provide us with an attribution linkHow to Provide Attribution?Article Link to be HyperlinkedFor eg:Source: Compare Dates in Excel (wallstreetmojo.com)

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

Comparing 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 or not.

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

  • Look at the below data to compare dates in excel. Now in cell C2, apply the formula as =A2=B2. Press Enter to get the result. We have the same date in both columns, so we got TRUE as a result. Drag the formula to the following columns as well to get the result.

We have the same date in both columns, so we got TRUE as a result.

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.

The reason why 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.

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

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 excelIF Function In ExcelIF function in Excel evaluates whether a given condition is met and returns a value depending on whether the result is “true” or “false”. It is a conditional function of Excel, which returns the result based on the fulfillment or non-fulfillment of the given criteria.

  • read more in the “MATCH” column.

  • The first criterion of the formula is a logical test in excelLogical Test In ExcelA logical test in Excel results in an analytical output, either true or false. The equals to operator, “=,” is the most commonly used logical test.read more, 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.

  • 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 value as “Both are Correct.”

  • The next argument is value if false, so if the logical test is not correct, then what is the value needed? We need the values as “Both are Not Correct.”

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

Drag the formula to other cells.

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

#2 – Compare If 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 date. For this, look at the below example data.

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

There you go, we have results.

Similarly, we just need to change the logical operator in excelLogical Operator In ExcelLogical operators in excel are also known as the comparison operators and they are used to compare two or more values, the return output given by these operators are either true or false, we get true value when the conditions match the criteria and false as a result when the conditions do not match the criteria.read more from greater than symbol to less than symbol to do the other way around the calculation.

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 need to be aware of it.There is a situation date stored as a text value in such cases, date-looking values are not dates, so you need to convert to date.

This has been a guide to Compare Dates in Excel. Here we discuss how to compare dates in excel to know if the date is equal to, greater than, or smaller than other dates. You can learn more from the following articles –

  • Compare Two Lists in ExcelCompare Two Lists In ExcelThe five different methods used to compare two lists of a column in excel are - Compare Two Lists Using Equal Sign Operator, Match Data by Using Row Difference Technique, Match Row Difference by Using IF Condition, Match Data Even If There is a Row Difference, Partial Matching Technique.read moreExcel Subtract DateMINVERSE in ExcelCalculating Investment Return using Excel