How to calculate the difference between two dates in Excel?

In Excel, you can calculate the difference between two dates by using the =DATEDIF function. This function takes two date values as inputs and calculates the difference between them in days, months, or years. You can also switch the order of the dates to calculate the duration from the later date to the earlier date. Alternatively, you may also subtract the two dates to get the difference in days.


We can use the DATEDIF() function to calculate the difference between two dates in Excel.

This function uses the following syntax:

=DATEDIF(Start_Date, End_Date, Metric)

where:

  • Start_Date: The start date
  • End_Date: The end date
  • Metric: The metric to calculate. Options include:
    • “d”: Days
    • “m”: Months
    • “y”: Years

It’s important to note that this function won’t automatically appear in Excel until you completely type =DATEDIF( into one of the cells. 

The following examples show how to use this function to calculate the difference between two dates in Excel.

Example 1: Difference in Days

The following image shows how to calculate the difference (in days) between two dates:

Date difference in days in Excel

This tells us that there are 1,127 full days between 1/1/2018 and 2/1/2021.

Example 2: Difference in Months

The following image shows how to calculate the difference (in months) between two dates:

Difference in dates in months in Excel

Example 3: Difference in Years

The following image shows how to calculate the difference (in years) between two dates:

Difference in years between two dates in Excel

Example 4: Difference in Years & Months

The following image shows how to calculate the difference (in years and months) between two dates:

Difference in years and months between two dates in Excel

You can find more Excel tutorials on .

x