# DATEDIF Function

• Applies to: Excel for Microsoft 365, Excel for Microsoft 365 for Mac, Excel for the web, Excel 2019, Excel 2016, Excel 2019 for Mac, Excel 2013, Excel 2010, Excel 2007, Excel 2016 for Mac, Excel for Mac 2011, SharePoint Foundation 2010, SharePoint Server 2010, Excel Starter 2010, Windows SharePoint Services 3.0.

The DATEDIF function works out the number of days, months, or years between two dates.

Warning: Excel supplies the DATEDIF function as a way to support older workbooks from Lotus 1-2-3. The DATEDIF function might calculate inaccurate results within specific circumstances. Please refer to the known issues section of this article for more information.

## DATEDIF Function Syntax

DATEDIF(start_date,end_date,unit)

## Remarks of the DATEDIF Function

• Dates are occupied as sequential serial numbers to ensure their usage in calculations. Automatically, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,447 days after January 1, 1900.
• The DATEDIF function is helpful in formulas where you must calculate an age.
• If the start_date is greater than the end_date, the result will be #NUM!.

## Known issues

The “MD” argument could result in a negative number, a zero, or an inaccurate result. If you are attempting to calculate the remaining days following the last completed month, here is a workaround:

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

## Need more help?

You can always ask an expert in the Excel Tech Community, get support in the Answers community, or suggest a new feature or improvement on Excel User Voice.