DATEDIF
Date & timeExcel 2007Whole years / months / days between two dates.
Syntax
DATEDIF(start_date, end_date, unit)
Arguments
- start_date
- The earlier date.
- end_date
- The later date.
- unit
- "Y" whole years, "M" whole months, "D" days, "MD" days ignoring months/years, "YM" months ignoring years, "YD" days ignoring years.
How it works
A legacy function kept for compatibility — it isn't in the function list and Excel gives no argument help, but it works.
Examples
=DATEDIF(A2, TODAY(), "Y")
→ age in whole years
=DATEDIF(A2, B2, "Y") & "y " & DATEDIF(A2, B2, "YM") & "m"
→ "3y 7m"
Good to know
- The "MD" unit has known bugs at month boundaries — avoid it for anything precise.
Related functions
More Date & time functions
Syntax follows Microsoft’s documentation. Examples are written to be pasted into a cell and checked. Argument separators may be ; in your locale. The AI explainer runs on a free community model — verify anything important.