Skip to main content

Date formula page

Calculate Age Formula

Use DATEDIF when age should count completed years rather than rounded year differences.

Best for

Calculate age from date of birth in Excel or Google Sheets.

What it returns

If A2 is 1990-05-20 and today is 2026-05-20, the result is 36.

Copy formulas

Excel formula
=DATEDIF(A2, TODAY(), "Y")
Google Sheets formula
=DATEDIF(A2, TODAY(), "Y")
Excel / Google Sheets difference

Excel and Google Sheets both support DATEDIF(A2, TODAY(), "Y") for completed years. TODAY makes the displayed age update when the current date changes.

Example data

Start DateEnd DateHolidayResult
2026-01-012026-01-312026-01-1930
2026-02-102026-03-1230
1990-05-202026-05-2036
What it returns

If A2 is 1990-05-20 and today is 2026-05-20, the result is 36.

How the formula works

  • A2 is the birth date or start date.
  • TODAY returns the current date.
  • Y returns completed years.
Syntax pieceRole in the formula
A2The birth date or other starting date.
TODAY()The current date used as the end date.
"Y"The DATEDIF unit for completed whole years.

Verified examples

Thirty-six birthdays
=DATEDIF(A2, TODAY(), "Y")

Excel: Set A2 to =EDATE(TODAY(),-12*36). Returns: 36

Exact birthday
=DATEDIF(DATE(1990,5,20),DATE(2026,5,20),"Y")

Google Sheets: Use the fixed dates in the formula. Returns: 36

Day before birthday
=DATEDIF(DATE(1990,5,20),DATE(2026,5,19),"Y")

Excel: Use the fixed dates in the formula. Returns: 35

Common errors and fixes

IssueLikely causeFix
DATEDIF returns #NUM!The birth date is later than TODAY or the end date.Validate that the starting date is not in the future before calculating age.
A valid date is treated as textThe imported date is text rather than a spreadsheet date serial.Convert the source to a real date with DATEVALUE or a locale-appropriate date conversion.
The result changes around a birthdayThe Y unit reports completed years, so it changes on the birthday and relevant leap-day boundary.Use a different date-difference definition if anniversary behavior is not the intended rule.

When not to use this formula

  • Do not use completed-year age when the calculation must include months, days, or a legal age rule defined outside the workbook.

Alternatives

AlternativeWhen to use it
Days Between Dates FormulaUse when elapsed days rather than completed years are required.
Date Difference Formula BuilderUse when the output unit and date boundaries need guided selection.

Related formulas

Official references

FAQ

Does DATEDIF with Y return completed years?

Yes. The "Y" unit returns whole years completed between the two dates.

Why does TODAY make the age update?

TODAY recalculates to the current date, so the completed-year result changes when the next birthday boundary is reached.