SpreadsheetFormulas
beginnerDATEDIFTODAY

Calculate Years Between Two Dates

You have a start date — a birthdate, hire date, contract start, account creation — and need how many full years have passed since.

Quick formula
=DATEDIF(B2,TODAY(),"Y")
Sample input
1NameStart Date
2Ana Torres2019-03-15
3Ben Okafor2020-09-01
Result
1NameYears
2Ana Torres7
3Ben Okafor5

Excel & Google Sheets

=DATEDIF(B2,TODAY(),"Y")

This formula works in both Excel and Google Sheets.

How it works

DATEDIF measures the gap between two dates in the unit you pick: "Y" for completed years, "M" for completed months, "D" for days. It counts anniversaries, not calendar years — someone who started 15 March 2019 has 7 completed years on 8 July 2026, but someone who started 1 September 2020 has 5, because their sixth anniversary hasn't arrived yet. Excel accepts DATEDIF in every version but hides it from the function autocomplete — it's a documented leftover from Lotus 1-2-3, and it works.

B2
The start date — must be earlier than the end date.
TODAY()
The end date. Swap in any cell to measure between two fixed dates.
"Y"
Completed years. Use "M" for months, "D" for days, "YM" for months beyond the last full year.

When to use it

Use it for age from a birthdate, employee tenure, customer lifetime, equipment age, or contract duration — anywhere "how many full years" is the question.

Common mistakes

  • Start and end dates reversed.

    DATEDIF(TODAY(),B2,"Y") with a past date returns #NUM!. The earlier date goes first.

  • Expecting "Y" to subtract calendar years.

    2019 to 2026 isn't automatically 7 — it's 6 until the anniversary passes. That's usually what you want for age and tenure; if you truly want calendar-year subtraction, use =YEAR(A2)-YEAR(B2).

  • Typing it and finding no autocomplete in Excel.

    DATEDIF doesn't appear in Excel's function list, but it calculates fine once entered. It's not a typo.

Did this formula help?

Engine-verified against the sample data aboveLast reviewed 2026-07-08