Date Difference Calculator (DATEDIF)
Pick a start and end date to see the difference in years, months, and days — and copy the exact DATEDIF formula to reproduce it in Excel or Google Sheets. DATEDIF is the go-to function for ages, tenures, and durations.
The calculation runs in your browser.
=DATEDIF("2020-03-15", "2026-07-27", "Y") & " years, " & DATEDIF("2020-03-15", "2026-07-27", "YM") & " months, " & DATEDIF("2020-03-15", "2026-07-27", "MD") & " days"DATEDIF units explained
=DATEDIF(start_date, end_date, unit). The unit is a text code: "Y" whole years, "M" whole months, "D" total days.
"YM" gives the leftover months after whole years, "MD" the leftover days after whole months, and "YD" the days ignoring years. Combine "Y", "YM", and "MD" to display a full 'X years, Y months, Z days' age.
Why DATEDIF isn't in the function list
DATEDIF is a legacy function kept for compatibility, so Excel doesn't show it in autocomplete — but it still works if you type it. It also exists in Google Sheets with the same syntax.
Frequently asked questions
How do I calculate age in Excel?
Use =DATEDIF(birthdate, TODAY(), "Y") for whole years. For a precise age, combine units: =DATEDIF(birthdate, TODAY(), "Y") & " years, " & DATEDIF(birthdate, TODAY(), "YM") & " months".
Why does DATEDIF return a #NUM! error?
That usually means the start date is later than the end date. DATEDIF requires start_date ≤ end_date.
Does DATEDIF work in Google Sheets?
Yes, with identical syntax and unit codes.
Keep exploring
Analyze a whole spreadsheet with AI
Upload an Excel or CSV file and get pivots, outlier detection, and Smart BI dashboards in seconds. Free to start — no credit card.
Open the App Free