How do I calculate the difference between two dates in Excel?

Calculating the difference between two dates in Excel can be done using the DATEDIF function. This function takes in three arguments: the start date, the end date, and the unit of measurement for the difference (such as days, months, or years). The result will be the number of units between the two dates. It is important to note that the DATEDIF function may not work properly if the start date is after the end date. Additionally, the result may not be accurate if the two dates are in different years. To ensure accuracy, it is recommended to use the YEAR, MONTH, and DAY functions to extract the individual components of the dates and then perform the calculation. This process can be helpful for various tasks, such as tracking project timelines or calculating employee tenure.

Calculate the Difference Between Two Dates in Excel


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