Example
Sponsored Link
Purpose
Get days, months, or years between two dates
Return value
A number representing time between two dates
Syntax
=DATEDIF (start_date, end_date, unit)
Arguments
- start_date – Start date in Excel date serial number format.
- end_date – End date in Excel date serial number format.
- unit – The time unit to use (years, months, or days).
Usage notes
The DATEDIF (Date + Dif) function is a “compatability” function that comes from Lotus 1-2-3. For reasons unknown, it is only documented in Excel 2000, but you can use it in your formulas in all Excel versions since that time.
The DATEDIF function calculates the time between a start_date and an end_date in years, months, or days. The time unit to return is specified using the unit argument. Unit is supplied as text, using any one of these values:
Unit | Return value |
---|---|
“Y” | Difference in complete years |
“M” | Difference in complete months |
“D” | Difference in days |
“MD” | Difference in days, ignoring months and years |
“YM” | Difference in months, ignoring days and years |
“YD” | Difference in days, ignoring years |