DATEDIF function

Calculates the number of days, months, or years between two dates. Warning: Excel provides the DATEDIF function in order to support older workbooks from Lotus 1-2-3. The DATEDIF function may calculate incorrect results under certain scenarios. Please see the known issues section of this article for further details.



Start_date     A date that represents the first, or starting, date of the period. Dates may be entered as text strings within quotation marks (for example, "2001/1/30"), as serial numbers (for example, 36921, which represents January 30, 2001, if you're using the 1900 date system), or as the results of other formulas or functions (for example, DATEVALUE("2001/1/30")).

End_date     A date that represents the last, or ending, date of the period.

Unit     The type of information that you want returned:




The number of complete years in the period.


The number of complete months in the period.


The number of days in the period.


The difference between the days in start_date and end_date. The months and years of the dates are ignored.

Important: We don't recommend using the "MD" argument, as there are known limitations with it. See the known issues section below.


The difference between the months in start_date and end_date. The days and years of the dates are ignored


The difference between the days of start_date and end_date. The years of the dates are ignored.


  • Dates are stored as sequential serial numbers so they can be used in calculations. By default, December 31, 1899 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900.

  • The DATEDIF function is useful in formulas where you need to calculate an age.





Description (Result)




Two complete years in the period (2)




440 days between June 1, 2001, and August 15, 2002 (440)




75 days between June 1 and August 15, ignoring the years of the dates (75)

Known issues

The "MD" argument may result in a negative number, a zero, or an inaccurate result. If you are trying to calculate the remaining days after the last completed month, here is a workaround:

=DATEDIF(D17,E17,"md") and result: 5

This formula subtracts the first day of the ending month (5/1/2016) from the original end date in cell E17 (5/6/2016). Here's how it does this: First the DATE function creates the date, 5/1/2016. It creates it using the year in cell E17, and the month in cell E17. Then the 1 represents the first day of that month. The result for the DATE function is 5/1/2016. Then, we subtract that from the original end date in cell E17, which is 5/6/2016. 5/6/2016 minus 5/1/2016 is 5 days.

Share Facebook Facebook Twitter Twitter Email Email

Was this information helpful?

Great! Any other feedback?

How can we improve it?

Thank you for your feedback!