DATEDIF: years, months and days between two dates
DATEDIF returns the full years, months or days between two dates: =DATEDIF(start, end, unit). Excel doesn't suggest it as you type, but it works in every version.
Which units can you use?
| Unit | Returns |
|---|---|
"Y" | complete years |
"M" | complete months |
"D" | days |
"YM" | months left over after full years |
"MD" | days left over after full months |
How do you calculate age or tenure?
Birth date in B2:
=DATEDIF(B2,TODAY(),"Y")
Years and months of service, start date in C2:
=DATEDIF(C2,TODAY(),"Y")&" years, "&DATEDIF(C2,TODAY(),"YM")&" months"
What are the traps?
The start date must not be later than the end date, otherwise you get #NUM!. Microsoft warns that the "MD" unit can return wrong results in some cases, so avoid it in anything important.
Try it yourself. Practise this in a real spreadsheet in your browser, with instant feedback.
Practise DATEDIF
Practise DATEDIF
Updated November 2026.