DATEDIF Formula Generator (2026) — Calculate Date Difference | Free Excel & Sheets
Calculates the number of days, months, or years between two dates.
Common Errors & Fixes
#NUM! error
Causes:- Start date is later than end date. DATEDIF does not handle reversed dates.
Fixes:- Use =IF(start > end, -DATEDIF(end, start, unit), DATEDIF(start, end, unit)) for signed results, or swap the arguments.
Frequently Asked Questions
Why is DATEDIF not showing up in my Excel?
DATEDIF is a hidden function in modern Excel. It still works but does not appear in the formula autocomplete. Type =DATEDIF( manually and it will work.
What DATEDIF units are available?
"Y" for complete years, "M" for complete months, "D" for days, "YM" for months ignoring years, "YD" for days ignoring years, and "MD" for days ignoring months and years.
Does DATEDIF work in Google Sheets?
Yes, DATEDIF works in Google Sheets with the same syntax. All unit types (Y, M, D, YM, YD, MD) are supported.
Related Formulas
Want to become an Excel Pro?
Stop searching for formulas. Master Excel in 30 days with this top-rated course.
Learn More