DATEDIF
Date & Time FormulasMaster DATEDIF to calculate differences between dates in years, months, or days. Perfect for age calculations and tenure tracking.
Syntax
DATEDIF(start_date, end_date, unit)Parameters
start_dateThe starting date
end_dateThe ending date
unit"Y"=years, "M"=months, "D"=days, "MD"=days ignoring months/years, "YM"=months ignoring years, "YD"=days ignoring years
Examples
=DATEDIF(A1, TODAY(), "Y")Calculate age in complete years
=DATEDIF(A1, B1, "M")Months between two dates
=DATEDIF(A1,B1,"Y")&" years, "&DATEDIF(A1,B1,"YM")&" months"Age in years and months
Common Errors
#NUM! - Start date is after end date
#VALUE! - Invalid unit code
Pro Tips
DATEDIF is undocumented but works in all Excel versions
Start date must be before end date
Combine units for detailed age/tenure display
Related Functions
Need Help with DATEDIF?
Describe your specific use case and our AI will generate the perfect DATEDIF formula for you.
Generate DATEDIF Formula