Calculate the difference between two dates in years, months, or days.
DATEDIF works in Google Sheets the same way, including the "Y", "M", and "D" units.
DATEDIF(start_date, end_date, unit)DATEDIF returns the elapsed time between two dates in the unit you choose — "Y" for whole years, "M" for months, "D" for days. It's ideal for age, tenure, and duration calculations. The function is hidden in Excel's menus but fully supported.
=DATEDIF(A2, TODAY(), "Y")Result: 7
Returns whole years between a hire date and today.
=DATEDIF(A2, B2, "D")Result: 146
Returns the number of days between two dates.
It's a legacy compatibility function Microsoft keeps hidden, but it works in all modern versions when typed manually.