ExcelReady
CourseFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before the interview. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Function guides
  • Blog

Product

  • Certificate

Company

  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Dates
  3. Calculate Age or Years of Service in Excel

Calculate Age or Years of Service in Excel

By ExcelReady Team·Updated October 30, 2026·6 min read

The short answer

To calculate age in Excel, use =DATEDIF(B2,TODAY(),"Y"), where B2 is the birth date. It counts complete years, so the age only goes up on the birthday. Years of service work the same way with the hire date. For a report that must not change, replace TODAY() with a fixed "as of" date cell.

Key takeaways

  • DATEDIF(start, end, "Y") counts complete years, which is exactly how age and tenure are measured.
  • YEAR(end)-YEAR(start) overcounts by one for anyone whose birthday hasn't come yet this year.
  • Dividing the days by 365 drifts because of leap years and can add a year just before a birthday.
  • Combine "Y" and "YM" to write tenure as years and months, like 9 yrs, 2 mos.
  • Use TODAY() for live sheets and a fixed date cell for reports, tests and anything you need to check.
On this page+
  1. What is the formula to calculate age in Excel?
  2. How do you calculate age on a fixed date?
  3. Why not subtract the years or divide by 365?
  4. How to calculate years of service
  5. How do you get age with decimals?
  6. What about leap-day birthdays and other edge cases?
  7. Practise it

To calculate age in Excel, use DATEDIF to count the complete years between a birth date and today, or any other end date. Years of service, or tenure, is the same calculation with a hire date. This guide shows the formula, why the two shortcuts most people try give wrong answers, and how to write tenure as years and months.

What is the formula to calculate age in Excel?#

Use DATEDIF with the unit "Y":

Excel formula
=DATEDIF(B2,TODAY(),"Y")
PartMeaning
B2The start date: the birth date. It must come first.
TODAY()The end date: today, updated every time the file recalculates
"Y"Count complete years only

"Complete" is the key word. Someone born on July 15 doesn't turn a year older until July 15, and DATEDIF follows that rule. If the start date is after the end date, DATEDIF returns #NUM!, so check the order.

Excel doesn't suggest DATEDIF as you type, and it doesn't show its arguments. It still works in current versions on Windows and Mac; type the full name. The DATEDIF function guide covers every unit.

How do you calculate age on a fixed date?#

Put the date in a cell and point at it. Reports, audits and job tests usually need an "as of" date, because an answer based on TODAY() is different tomorrow:

Excel formula
=DATEDIF(B2,$F$1,"Y")

Here F1 holds =DATE(2025,6,30). The dollar signs keep every row pointing at F1 when you fill down. Building the date with DATE avoids regional confusion: 6/30/2025 is a valid US date, but a UK copy of Excel might read a typed date like that as text. The results:

EmployeeBirth DateAge on Jun 30, 2025
Ana LopezJul 15, 199034
Ben CarterJun 30, 198540
Chen WeiFeb 29, 200025
Dana FoxDec 1, 197846
Eli StoneJul 3, 200123

Ben turns 40 exactly on the report date, and DATEDIF counts it. Ana and Eli have birthdays in July, so they haven't reached their next year yet.

For a live sheet, such as an HR list that should always be current, TODAY() is the right choice. The trade-offs are explained in TODAY vs NOW in Excel.

Why not subtract the years or divide by 365?#

Both shortcuts look right and give wrong answers for some people:

Employee=YEAR($F$1)-YEAR(B2)=INT(($F$1-B2)/365)Correct (DATEDIF)
Ana Lopez353434
Dana Fox474646
Eli Stone242423
  • Subtracting the years ignores the month and day. Anyone whose birthday is later in the year gets one year too many. Ana and Dana are both overcounted.
  • Dividing by 365 ignores leap years. Over 24 years, the extra leap days add up, so Eli is pushed past his birthday a few days early. Dividing by 365.25 is closer, but it can still be a day out around birthdays.

DATEDIF compares the actual month and day, so it's right every time. If an interviewer asks why you didn't subtract the years, this table is your answer.

How to calculate years of service#

Tenure uses the same formula with the hire date. Add the "YM" unit for the months left over after the complete years:

Excel formula
=DATEDIF(C2,$F$1,"Y")&" yrs, "&DATEDIF(C2,$F$1,"YM")&" mos"
EmployeeHire DateYearsExtra monthsTenure text
Ana LopezApr 11, 2016929 yrs, 2 mos
Ben CarterAug 26, 20195105 yrs, 10 mos
Chen WeiJun 13, 2022303 yrs, 0 mos
Eli StoneSep 16, 2024090 yrs, 9 mos

Use "M" for total complete months, which is handy for probation periods or "months active" counts. Ben's total is 70 months. The spaces inside " yrs, " and " mos" keep the text readable.

For leavers, use the leaving date as the end date instead of TODAY() or the report date. For more on the units, and on plain day counts, see how to count the days between two dates.

How do you get age with decimals?#

YEARFRAC returns the fraction of years between two dates:

Excel formula
=YEARFRAC(B2,$F$1,1)

For Ana, that's about 34.96. The 1 is the basis: it tells Excel to use the actual number of days in each month and year. Decimal ages are useful for averages, such as the average age of a team. For whole years, INT(YEARFRAC(...)) usually matches DATEDIF, but DATEDIF says what you mean more clearly.

What about leap-day birthdays and other edge cases?#

A few cases are worth knowing before a test:

  • Born on February 29. In years without a February 29, DATEDIF counts the new year from March 1. Chen turns 25 on Mar 1, 2025, not Feb 28.
  • Dates stored as text. If a birth date sits on the left of the cell, it's probably text, and DATEDIF returns #VALUE!. =ISNUMBER(B2) returns TRUE for a real date.
  • Results shown as dates. If an age displays as something like 1/3/1900, the cell has a date format. Change it to General.
  • Age bands. To group people into bands such as under 30, 30 to 44 and 45 or over, use the age in a nested IF or IFS.

To build dates from separate year, month and day columns first, see DATE, YEAR, MONTH and DAY in Excel. To check which day of the week an anniversary falls on, see WEEKDAY in Excel. Age and tenure questions are common in HR roles; see the Excel skills HR jobs ask for.

Practise it#

Try the age exercise on this page, then practise DATEDIF and tenure in a live spreadsheet, from simple day counts to a "7 yrs, 11 mos" label. When you're ready, the gym membership skill summary puts DATE, EDATE, DATEDIF and TEXT together on one sheet.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

The report date is in F1. In C2, calculate Ana's age on that date: use DATEDIF with her birth date in B2 first, the report date second, and the unit "Y". Lock the report date as $F$1.

fx
ABCDEFG
1
Employee
Birth Date
Age
As of
45838
2
Ana Lopez
33069
3
Ben Carter
31228
4
Chen Wei
36585
5
Dana Fox
28825
6
Eli Stone
37075
7
8
9

Tip: DATEDIF takes the start date, then the end date, then the unit in double quotes. Ana's birthday is in July, so she hasn't turned 35 yet.

Practise this in a lesson

LessonDays between dates: DAYS, DATEDIF and TODAYMeasure the gap between two dates in days, months and years, and calculate tenure as of today.LessonDate skill summary: gym membershipsPractice the whole dates module on one sheet: rebuild dates with DATE, find renewals with EDATE, measure time with DATEDIF and TODAY, and write readable notes with TEXT.Function guideDATEDIFCalculate tenure, age and contract length with DATEDIF. Learn every unit (Y, M, D, YM), the hidden-function quirks, and practice live.

Frequently asked questions

What is the formula to calculate age in Excel?

+

Use =DATEDIF(B2,TODAY(),"Y") with the birth date in B2. It returns the age in complete years and updates automatically every day.

How do I calculate age on a specific date?

+

Put that date in a cell, for example F1, and use =DATEDIF(B2,F1,"Y"). You can also write the date into the formula with DATE, like =DATEDIF(B2,DATE(2025,6,30),"Y").

How do I calculate years of service in Excel?

+

Use DATEDIF with the hire date: =DATEDIF(C2,TODAY(),"Y") for complete years, and =DATEDIF(C2,TODAY(),"YM") for the extra months.

Why is DATEDIF not in Excel's function list?

+

DATEDIF is an older function kept for compatibility. It works in current Excel for Windows and Mac, but Excel doesn't suggest it as you type, so enter the full name yourself.

How do I calculate age with decimals?

+

Use YEARFRAC: =YEARFRAC(B2,F1,1) returns the age as a decimal, such as 34.96. Wrap it in INT for whole years, though DATEDIF is the clearer choice.

Sources

  • DATEDIF function - Microsoft Support
  • YEARFRAC function - Microsoft Support
  • TODAY function - Microsoft Support

Written and checked by the ExcelReady Team. First published October 30, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. What is the formula to calculate age in Excel?
  2. How do you calculate age on a fixed date?
  3. Why not subtract the years or divide by 365?
  4. How to calculate years of service
  5. How do you get age with decimals?
  6. What about leap-day birthdays and other edge cases?
  7. Practise it

Keep reading

Dates· 6 min read

WEEKDAY in Excel: Find Weekends and Day Names

The Excel WEEKDAY function returns the day of the week as a number: =WEEKDAY(date) gives 1 for Sunday through 7 for Saturday. Add a return type of 2, as in =WEEKDAY(date,2), to make Monday 1 and Sunday 7. Then =WEEKDAY(date,2)>5 is TRUE only for Saturdays and Sundays.

Dates· 6 min read

DATE, YEAR, MONTH and DAY in Excel

The Excel DATE function builds a real date from three numbers: =DATE(year, month, day), always in that order. YEAR, MONTH and DAY do the opposite and pull one part out of a date, like =YEAR(B2). Because Excel stores dates as serial numbers, the results can be added, subtracted and compared.

Dates· 6 min read

Days Between Two Dates in Excel (and DATEDIF)

To count the days between two dates in Excel, subtract the earlier date from the later one: =C2-B2. DAYS does the same with the end date first: =DAYS(C2,B2). For whole months or years, use DATEDIF with the start date first and a unit in quotes, like =DATEDIF(B2,C2,"Y").

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback. The first lessons are free, with no download.

Start learning for free