DATEDIF: calculate age in years

Lesson 35 of 54

DATEDIF counts the whole years, months or days between two dates, which makes it the standard age formula: =DATEDIF(birthday, TODAY(), "Y"). It works in Excel and Google Sheets, though Excel doesn't suggest it as you type.

In this lesson, today is June 30, 2026. In cell C2, write a formula that calculates Ana's age in whole years, using DATEDIF and TODAY. Fill down should work too.

C2
ABC
1NameBirthdayAge
2Ana8/15/1990
3Luis3/2/1985
4Marta6/30/2000

Type in the formula bar above and press Enter to check.

Skip

How DATEDIF works

Syntax

=DATEDIF(start_date, end_date, unit)
start_date
The earlier date, such as a birthday or hire date.
end_date
The later date. Use TODAY() for "as of today".
unit
"Y" whole years, "M" whole months, "D" days, "YM" months left over after the years, "MD" days left over after the months.

Example

An employee's start date is in B2. You want "3 years, 4 months" of service.

=DATEDIF(B2, TODAY(), "Y") & " years, " & DATEDIF(B2, TODAY(), "YM") & " months"

Shows the complete years and the months on top, such as 3 years, 4 months.

Common mistakes

  • Putting the dates in the wrong order. If the start is after the end you get #NUM!.
  • Dates stored as text, like "15/08/1990" typed in the wrong order for your settings. Check they line up to the right, which means they are real dates.
  • Expecting autocomplete in Excel. DATEDIF is an older, undocumented function, so type it in full.

Questions people ask

How do I calculate age in Excel?

Use =DATEDIF(B2, TODAY(), "Y") with the birthday in B2. It counts only birthdays that have already happened.

Is there an alternative to DATEDIF?

=INT(YEARFRAC(B2, TODAY())) gives whole years too.

Practice it above: type the formula in the formula bar and press Enter to check.