The DATEDIF Excel which falls under the Date/Time functions is very important for calculating the difference in days, months, or years between two dates. This makes it valuable for financial analysts who do precise temporal analysis to determine durations for investments, financial instruments, or key events. With no official documentation, the function is widely used and trusted in Excel. It provides flexibility by allowing results to be customized according to specific requirements hence making it useful for accurate date-related calculations.


The formula for the DATEDIF Excel is expressed as follows:

=DATEDIF(start_date, end_date, unit)

The DATEDIF function involves three key arguments:

start_date: This is a mandatory parameter, representing the initial date of the specified period.

end_date: Also mandatory, it signifies the concluding date or end point of the given period.

unit: This argument determines the time unit in which the information is desired, allowing users to calculate the difference in years, months, or days according to their specific requirements.

How to use the DATEDIF Excel?

Example 1:


A1 contains the start date: January 1, 2020

B1 contains the end date: December 31, 2022

Step 1: Input Dates

Enter the start date in cell A1 and the end date in cell B1.

A1: January 1, 2020

B1: December 31, 2022


Step 2: Use the DATEDIF Formula

In a different cell (let’s say C1), input the following formula:

=DATEDIF(A1, B1, “Y”)


Step 3: Get the Result

Press Enter. The result will be displayed in cell C1.

C1: 2

This result (2) indicates that there are 2 years between January 1, 2020, and December 31, 2022.

You can follow these steps and experiment with different dates and units (“M” for months, “D” for days) to understand how the DATEDIF Excel calculates the time difference between two dates in Excel.

Example 2:

Suppose we want to determine the number of days between May 10, 2014, and July 10, 2018.

Using DATEDIF Function:


=DATEDIF(DATE(2014, 5, 10), DATE(2018, 7, 10), “d”)


This formula calculates the difference in days between May 10, 2018, and July 10, 2018.

Using Cell References:

Assuming the start date is in cell A1 and the end date is in cell B1:

=DATEDIF(A1, B1, “d”)


This formula, with cell references, accomplishes the same result.


As an alternative, we can represent the dates directly with serial numbers:

=DATEDIF(42134, 42205, “m”)


Here, 42134 corresponds to May 10, 2015, and 42205 corresponds to July 10, 2017. The formula calculates the difference in months.

Please note that using serial numbers directly may have compatibility issues across different computer operating systems due to variations in date numbering.