DATEDIF()
Calculates the difference between two dates in years, months, or days.
DATEDIF(start_date, end_date, unit)DATEDIF returns the elapsed time between two dates in whatever unit you ask for: "Y" full years, "M" full months, "D" total days, or the combination units "YM" (months, ignoring years), "YD" (days, ignoring years), and "MD" (days, ignoring months and years).
It's a genuinely useful function for ages and tenure calculations, but it's undocumented — it won't appear in Excel's function autocomplete or picker, even though it works when typed manually.
Arguments
- start_date
- The earlier date.
- end_date
- The later date.
- unit
- "Y", "M", "D", "YM", "YD", or "MD" — which unit and remainder to return.
Examples
=DATEDIF(B2, TODAY(), "Y")→3
Full years since the date in B2 — a common way to calculate age or tenure.
=DATEDIF(B2, C2, "D")→47
Total days between two dates.