FORMULAS & FUNCTIONS

How to Calculate Age in Excel with DATEDIF (Years, Months, Days)

To calculate age in Excel from a date of birth, use =DATEDIF(birth date, today, “Y”). It returns completed years, the way people count their age. This guide shows the formula as of today or a specific date, the age in years, months and days, the YEARFRAC alternative, how to avoid the #NUM! error and the blank-date trap, and how to use the same formulas for a team: ages, years of service, next birthdays and age bands, with a free workbook.

Calculate age in Excel with =DATEDIF(C3,C4,"Y"): born Mar 18, 1988, the age on Oct 31, 2026 is 38 years, 7 months and 13 days.
One function for years, months and days.

The age formula in Excel

=DATEDIF(C3,C4,"Y")
  • C3: the date of birth (the start date).
  • C4: the date you want the age on. Use =TODAY() for today, or type a date for a specific date such as a month end.
  • “Y”: the unit, completed years. Other units: "M" months, "D" days, "YM" months after the last birthday, "MD" days after the last full month.
Free download: Get the age calculator workbook (.xlsx). It has the Age calculator, an Employees sheet and How It Works. Works in Excel 2010 and later, Microsoft 365 and Excel for the web.

Step 1: Age in years with DATEDIF

Enter the date of birth in C3 and the as-of date in C4, then in C7:

=DATEDIF(C3,C4,"Y")

Someone born on Mar 18, 1988 is 38 on Oct 31, 2026. DATEDIF counts completed years, so they stay 38 until Mar 18, 2027. A simple =(C4-C3)/365 looks close but drifts with leap years and can show the new age a day early or late.

Excel DATEDIF formula =DATEDIF(C3,C4,"Y") returning an age of 38 from a date of birth of Mar 18, 1988 and an as-of date of Oct 31, 2026.
Completed years between the two dates.
Can’t find DATEDIF? DATEDIF is a hidden compatibility function: it does not appear in the function list or in autocomplete, and Excel shows no argument tooltip. It still works in every current version. Type the whole formula, including the quotes around the unit.

If the result looks wrong, check that both dates are real dates, not text. A date typed as text gives #VALUE!; see how to standardize mixed date formats.

Step 2: Age in years, months and days

Add the months after the last birthday and the days after the last full month:

=DATEDIF(C3,C4,"YM")
=C4-EDATE(C3,DATEDIF(C3,C4,"M"))

The first gives 7 months. The second counts total months, moves the birth date forward by that many months with EDATE, and subtracts: 13 days. You can also use DATEDIF(C3,C4,"MD"), which gives 13 here, but Microsoft warns that “MD” can return wrong results for some dates, so the EDATE version is the safer choice. Join the parts into one line of text:

=C7&" years, "&C8&" months, "&C10&" days"
Excel age in years, months and days with DATEDIF "YM" and "MD", joined as the text 38 years, 7 months, 13 days.
38 years, 7 months, 13 days.

The text result cannot be used in calculations; keep the numbers in their own cells. To format dates inside text, use TEXT, as in month labels with the TEXT function.

Step 3: Total months, total days and YEARFRAC

ResultFormulaValue
Total months=DATEDIF(C3,C4,"M")463
Total days=C4-C314,106
Age with decimals=YEARFRAC(C3,C4,1)38.62
Age in whole years=INT(YEARFRAC(C3,C4,1))38

Subtracting two dates gives days, because Excel stores dates as day numbers. YEARFRAC returns the fraction of years between two dates; basis 1 uses the actual days in each year. INT drops the decimals, so =INT(YEARFRAC(C3,C4,1)) is an alternative age formula that shows up in autocomplete. The workbook checks it against DATEDIF in C16: Ties.

Excel total months (463), total days (14,106) and YEARFRAC age of 38.62, with INT(YEARFRAC) matching DATEDIF.
Different units, the same two dates.

Step 4: Avoid #NUM! and blank-date surprises

Two things go wrong in real lists. If the start date is after the end date (a typo, or a future date), DATEDIF returns #NUM! in Excel. Check the order first:

=IF(C3>C4,"Check dates",DATEDIF(C3,C4,"Y"))

And if the date of birth is blank, Excel treats it as 0, a date in 1900, so the age shows as 126 instead of an error. Return a blank instead:

=IF(C3="","",DATEDIF(C3,C4,"Y"))
Excel age formulas guarded with IF: =IF(C3>C4,"Check dates",DATEDIF(C3,C4,"Y")) and a version that stays blank when the date of birth is empty.
Guard the formula before you copy it down a list.

For other errors, wrap the formula in IFERROR, but only after you know why the error happens; see IFERROR in Excel.

Step 5: Ages and years of service for a team

On the Employees sheet, the as-of date is in C2 and each row has a date of birth and a hire date. The same formulas work down the list, with the as-of date locked by $:

=DATEDIF(B5,$C$2,"Y")
=E5&" yrs "&DATEDIF(C5,$C$2,"YM")&" mos"

The first is the age; with the hire date in C5 instead of B5, the same formula gives completed years of service (E5). The second shows the service as years and months, which is how service awards, probation periods and leave entitlements are usually measured.

Excel employee list with age and years of service calculated by DATEDIF against a fixed as-of date of Oct 31, 2026.
Age and service from the same function.

Service-based leave? Combine years of service with an employee leave tracker. For working days between two dates rather than calendar time, use NETWORKDAYS with holidays.

Step 6: Next birthday and age bands

The next birthday is the date of birth plus (age + 1) years. EDATE adds months, so multiply by 12. If the birthday is today, show today:

=IF(EDATE(B5,12*D5)=$C$2,$C$2,EDATE(B5,12*(D5+1)))

Days to birthday is the next birthday minus the as-of date. Ana Reyes turns 35 on Nov 4, 2026, in 4 days; David Cruz’s birthday is the as-of date itself, so it shows 0. For Carla Mendoza, born on Feb 29, 2000, EDATE returns Feb 28, 2027, the last day of February in a non-leap year.

Count people in each age band with COUNTIFS, using the band limits in columns B and C:

=COUNTIFS($D$5:$D$12,">="&B15,$D$5:$D$12,"<="&C15)

The bands add up to 8, the headcount (check: Ties). For more on counting with two conditions on one column, see COUNTIFS with multiple criteria.

Excel next birthday formula with EDATE, days to birthday, and an age band summary with COUNTIFS that ties to a headcount of 8.
Upcoming birthdays and an age profile of the team.
Ready-to-share test: Change the as-of date in Age!C4 to Mar 18, 2027. The age becomes 39 years, 0 months, 0 days; on Employees, Ana Reyes turns 35 and Total = headcount still shows Ties. Change it back to Oct 31, 2026 (or to =TODAY()) when you are done.

Common age formula mistakes

SymptomCauseFix
Age is one year too high before the birthdayYEAR(C4)-YEAR(C3) subtracts calendar years onlyUse DATEDIF with “Y”, which checks the month and day
Age changes every day the file opensThe as-of date is =TODAY()Type a fixed date for reports you need to keep
#VALUE!A date is stored as textConvert the text to real dates first
#NUM!The start date is after the end datePut the date of birth first, or guard with IF
Age shows 126The date of birth is blankReturn “” when the cell is empty
Result shows as a date, like Feb 7, 1900The cell has a date formatFormat the result cell as Number or General

The last one surprises many people: when you type a formula next to a date column, Excel may copy the date format into the result. The age is right; only the format is wrong.

Frequently asked questions

How do I calculate age in Excel from a date of birth?

=DATEDIF(birth date,TODAY(),”Y”). Replace TODAY() with a cell containing a date to get the age on a specific date.

How do I show age in years and months?

=DATEDIF(B2,TODAY(),”Y”)&” years, “&DATEDIF(B2,TODAY(),”YM”)&” months”.

Why is DATEDIF not in Excel?

It is a hidden compatibility function. It does not appear in autocomplete or the function list, but it works when you type it in full.

Why does DATEDIF return #NUM!?

The start date is after the end date. Check the order with IF, or swap the arguments.

Is there an alternative to DATEDIF?

=INT(YEARFRAC(birth date,as-of date,1)) gives the same completed years in normal cases.

Final checklist

  • Both dates are real dates, not text.
  • The date of birth is the first argument and the as-of date the second.
  • The as-of date is fixed for a report, or =TODAY() for a live list.
  • Days use the EDATE version instead of “MD”.
  • Blank and reversed dates are handled with IF.
  • The as-of date is locked with $ before you copy the formula down.
Practice file: Download the age calculator and replace the sample dates with your own.

Work smarter with dates

Browse the ready-to-use Excel templates for HR and business, visit the OneXcel Tutorial Hub for more date formulas, or chart your team data in the OneXcel Dashboard Builder.