How to compare two dates in Excel

Comparing two dates in Excel means evaluating the relationship between the dates using different functions and operators to determine their relative position in time. It means evaluating whether the dates are the same, or if one date is earlier or later than the other. This can be useful for various purposes such as tracking progress, financial forecasting, and compliance.

In this tutorial we will learn how to compare two dates in excel.There are 2 methods to compare two dates. First is by using Formula and Second is by using IF function. Following are the steps that guide how to use function and formula to compare dates.

Method 1: Comparison by calculating difference of dates

In this method we’ll compare the dates by finding the simple difference of dates. We’ll subtract the first date from the second date and the sign of the difference of date i.e. a positive sign will tell us that the first date is earlier than the second date and vice versa. So, follow along the steps mentioned below to learn how to do it.

Step 1 – Select the cell 

  • Select the cell where you want to show the difference

 Step 2 – Use formula

  • Type the formula in the selected cell.Formula is:
  • =Address 1 – Address 2
  • Where Address 1 is address of First date
  • Where Address 2 is address of Second date

Step 3 – Press Enter key

  • Press Enter key after typing the formula  to get the required result. 

Method 2: Comparison by using IF Function

In this method we’ll use the IF function to perform a logical comparison between the dates and then display a useful message.

Step 1 –  Select the cell 

  • Select the cell where you want to show the difference

Step 2 – Use IF Function

  • Use IF function from insert function and a dialog box will appear

Step 3 – Fill the Dialog box

  • In the box next to Logical-test type Address1<Address2. Where Address 1 is address of First date and Address 2 is address of Second date
  • In the Box next to Value-if-true type “First date is Smaller”
  • In the Box next to Value-if-false type “Second date is Smaller”

Step 4 – Click on OK

  • Click on OK in the dialog box to get the required result