DATEDIF Formula Generator
DATEDIF calculates the difference between two dates in days, months, or years. Perfect for age, tenure, project duration. Note: Excel doesn't document it, but it works.
Syntax
=DATEDIF(start_date, end_date, unit)Try it — generate a DATEDIF formula
Examples
Age from birth date
=DATEDIF(A2, TODAY(), "Y")Years between A2 (birth date) and today — age in whole years.
Full months between dates
=DATEDIF(A2, B2, "M")Whole months from start date to end date.
Age in years + months format
=DATEDIF(A2, TODAY(), "Y") & "y " & DATEDIF(A2, TODAY(), "YM") & "m"Combines Y and YM units: "32y 5m".
Tips
- ✓Unit codes: "Y" years, "M" months, "D" days, "YM" months ignoring years, "MD" days ignoring months.
- ✓Returns #NUM! if start_date > end_date. Use ABS-style swap if needed.
- ✓Excel hides DATEDIF from autocomplete but still supports it. Google Sheets shows it normally.
Related Formulas
NETWORKDAYS
NETWORKDAYS calculates the number of working days between two dates, automatical...
PMT (Loan Payment)
PMT calculates the periodic payment for a loan based on constant payments and a ...
Nested IF
Nested IF formulas let you test multiple conditions and return different values ...
Need a different formula?
Describe any formula in plain English and FormulaPad will generate it.
Try FormulaPad Free