How to Calculate Age in Excel
To calculate age in Excel, use =DATEDIF(A2,TODAY(),"y"), where A2 holds the date of birth. It counts completed years, so the age goes up on the birthday and not a day before. Below: years, months and days, age on any date, and the two popular shortcuts that get birthdays wrong.
Quick Answer
Put the date of birth in A2 and enter =DATEDIF(A2,TODAY(),"y") in another cell. It returns the age in completed years. For the age on a set date, replace TODAY() with DATE(2026,9,1) or a cell that holds the date.
For years, months and days in one cell:
=DATEDIF(A2,TODAY(),"y")&" years, "&DATEDIF(A2,TODAY(),"ym")&" months, "&(TODAY()-EDATE(A2,DATEDIF(A2,TODAY(),"m")))&" days"Calculate Age With DATEDIF
DATEDIF counts the complete years, months or days between two dates. Microsoft's DATEDIF help page describes it as useful for formulas that calculate an age, and lists it for every current version from Excel 2016 to Microsoft 365, including Excel for Mac.
- Type the date of birth in A2 as a real date, for example 6/15/1998. If it lines up on the left of the cell, Excel is treating it as text (see Troubleshooting).
- In B2, enter =DATEDIF(A2,TODAY(),"y"). The birth date goes first and TODAY() supplies the current date.
- Press Enter. On October 30, 2026, a birth date of 6/15/1998 returns 28.
- Drag the fill handle down to calculate the rest of the column.
TODAY() recalculates whenever the workbook does, so the ages stay current. If you need ages frozen at a point in time, such as an enrollment record, use a fixed date instead (see Age on a specific date).
The units
The third argument picks what DATEDIF counts. Here is what each unit returns for a birth date of 6/15/1998 on October 30, 2026:
| Unit | What it counts | Result |
|---|---|---|
| "y" | Complete years | 28 |
| "m" | Complete months | 340 |
| "d" | Days | 10,364 |
| "ym" | Months left over after the complete years | 4 |
| "yd" | Days left over after the complete years | 137 |
| "md" | Days left over after the complete months (Microsoft advises against it) | 15 |
Is DATEDIF undocumented? No, though many older guides say so. Microsoft has a full help page for it. What's true is that Excel doesn't prompt for its arguments the way it does for most functions (Exceljet calls it a compatibility function from Lotus 1-2-3), so type all three yourself, with the unit in quotes.
Age in Years, Months and Days
The usual recipe strings three DATEDIF units together: "y" for the years, "ym" for the months left over and "md" for the days left over. The first two are solid, with one month-end quirk covered below. The third isn't. Microsoft's DATEDIF page warns that "md" can return a negative number, a zero or an inaccurate result, and Exceljet's tests show it doing exactly that: from January 31 to March 1, 2025, it returns -2.
Work out the days with EDATE instead. EDATE moves a date forward by a number of months, so moving the birth date forward by the number of complete months lands on the most recent "monthiversary". Subtract that from today and what's left is the days.
Years (B2)
=DATEDIF(A2,TODAY(),"y")Months (C2)
=DATEDIF(A2,TODAY(),"ym")Days (D2)
=TODAY()-EDATE(A2,DATEDIF(A2,TODAY(),"m"))All in one cell
=DATEDIF(A2,TODAY(),"y")&" years, "&DATEDIF(A2,TODAY(),"ym")&" months, "&(TODAY()-EDATE(A2,DATEDIF(A2,TODAY(),"m")))&" days"For 6/15/1998, on October 30, 2026, the one-cell version reads 28 years, 4 months, 15 days. Need only years and months? Stop after the months part: =DATEDIF(A2,TODAY(),"y")&" years, "&DATEDIF(A2,TODAY(),"ym")&" months".
| Birth date | As of | "md" | End date minus the 1st of its month | EDATE formula |
|---|---|---|---|---|
| 6/15/1998 | 10/30/2026 | 15 | 29 (wrong) | 15 |
| 1/31/2025 | 3/1/2025 | -2 (wrong) | 0 | 1 |
About Microsoft's own workaround: its Calculate the difference between two dates article replaces "md" with the end date minus the first day of its month. That only matches when the birth date falls on the 1st. For a June 15 birthday it gives 29 days on October 30, when the answer is 15. In the January 31 row, EDATE counts from February 28, because January 31 plus one month is the last day of February.
The month-end quirk: DATEDIF only counts a month once the day number comes round again. Birth dates on the 29th, 30th or 31st therefore come up a month short on the last day of a shorter month. Born January 31? On February 28 the one-cell formula reads 0 months, 28 days, and on March 1 it jumps to 1 month, 1 day. Exceljet's tests flag the same undercount in "m" and "ym", so check those rows by hand if a month either way matters.
Age on a Specific Date
Replace TODAY() with the date you care about. Build it with the DATE function rather than typing a date as text: Microsoft's YEARFRAC page warns that dates entered as text can cause problems, and DATE(2026,9,1) means September 1 in every regional setting.
Age on September 1, 2026 (a school or league cutoff)
=DATEDIF(A2,DATE(2026,9,1),"y")Age on the date in C2 (a hire date, an event)
=DATEDIF(A2,C2,"y")Age at the end of this year
=DATEDIF(A2,DATE(YEAR(TODAY()),12,31),"y")The date someone turns 18 (format the cell as a date)
=EDATE(A2,12*18)One wrinkle with that last formula. For a February 29 birthday, EDATE lands on February 28 in a common year, while DATEDIF only counts the new year from March 1. Someone born 2/29/2008 gets 2/28/2026 from EDATE, but DATEDIF says 17 on that day and 18 on March 1. Pick one rule for leap-day birthdays and use it everywhere.
Decimal Age With YEARFRAC
YEARFRAC returns the fraction of a year between two dates, which is what you want when you need 28.38 instead of 28. Use basis 1, actual/actual:
=YEARFRAC(A2,TODAY(),1)Leave the basis out and Excel uses 0, the US (NASD) 30/360 convention from finance, which treats every month as 30 days. Microsoft's YEARFRAC page lists all five bases.
Don't round it down for whole years
=INT(YEARFRAC(A2,TODAY(),1)) looks like a stand-in for DATEDIF, and most days it gives the same answer. On some birthdays it comes out a year short. When the dates span several years, basis 1 divides by the average length of the calendar years involved, so the result can land just under the whole number.
Born on 10/30/2000? On October 30, 2026, YEARFRAC returns 25.998, so INT says 25 on the 26th birthday. Exceljet ran into the same thing: June 30, 1960 to June 30, 1962 returns 1.998. Use YEARFRAC when you want the decimal and DATEDIF when you want the age.
Why Not Divide by 365.25?
=INT((TODAY()-A2)/365.25) is the other popular shortcut, and it has the same problem in a plainer form. The day count only reaches a multiple of 365.25 once enough leap days have passed, so on the birthday itself it often falls a fraction short. Someone born 1/1/2001 shows as 0 on 1/1/2002. Someone born 10/30/2000 shows as 25 on their 26th birthday.
=YEAR(TODAY())-YEAR(A2) fails the other way. It gives the age the person turns this year, so it's a year too high until the birthday comes round: for 10/30/2000 it says 26 on October 29, 2026. Microsoft's own Calculate age examples use this subtraction (with NOW() in place of TODAY()), and the 365.25 division too.
If you can't use DATEDIF, this version is exact. It subtracts one when this year's birthday hasn't arrived yet:
=YEAR(TODAY())-YEAR(A2)-(DATE(YEAR(TODAY()),MONTH(A2),DAY(A2))>TODAY())For February 29 birthdays, DATE rolls the missing day over to March 1, so this formula agrees with DATEDIF there too.
Which Age Formula to Use
| Formula | Right on birthdays? | Use it for |
|---|---|---|
| =DATEDIF(A2,TODAY(),"y") | Yes | Age in years. The default. |
| =YEAR(TODAY())-YEAR(A2)-(DATE(YEAR(TODAY()),MONTH(A2),DAY(A2))>TODAY()) | Yes | When DATEDIF isn't available |
| =YEARFRAC(A2,TODAY(),1) | Can be a year short once you apply INT | Ages with decimals |
| =INT((TODAY()-A2)/365.25) | Often a year short | Avoid |
| =YEAR(TODAY())-YEAR(A2) | A year high before the birthday | Avoid |
Troubleshooting
#NUM!
The start date is later than the end date, which Microsoft documents for DATEDIF. It's usually a birth date typed in the future, or the two dates swapped: the birth date goes first.
#VALUE!
Excel can't read one of the dates. The usual cause is a date stored as text, often from an import or typed in a different order (15/06/1998 on a computer set to month first). Text dates sit on the left of the cell. Microsoft's guide to converting dates stored as text covers the DATEVALUE fix, and Data > Text to Columns can convert a whole column if you choose the right date order in its last step.
Dates before January 1, 1900 can't be used in calculations at all, because that is the earliest date Excel calculates with. Ages from old genealogy records have to be worked out another way.
An age of 126 or more
The birth date cell is empty. Excel reads a blank as day zero (January 0, 1900) and counts the years since then, which in 2026 comes to 126. Wrap the formula so blank rows stay blank: =IF(A2="","",DATEDIF(A2,TODAY(),"y")).
The age shows as a date
Excel sometimes copies the date format into the formula cell, so 28 appears as 1/28/1900. Format the cell as General or Number, as Microsoft suggests.
The age doesn't update
TODAY() only changes when the workbook recalculates. In Excel for Windows, check File > Options > Formulas and make sure Calculation options is set to Automatic.
A year off on a birthday
You're using INT with YEARFRAC, or the 365.25 division. Switch to DATEDIF.
Leap-day birthdays
For someone born on February 29, DATEDIF counts the new year from March 1 in common years: 2/29/2000 to 2/28/2026 is 25, and to 3/1/2026 is 26. If your rules use February 28, adjust those rows by hand.
Stop bad birth dates at entry: a Data Validation date rule rejects anything that isn't a real date in the range you set, such as a birth date in the future. Our Excel date picker guide walks through it.
Frequently Asked Questions
What is the formula to calculate age in Excel?
Use =DATEDIF(A2,TODAY(),"y"), where A2 holds the date of birth. It returns the age in completed years and goes up on the birthday itself.
How do I calculate age in years, months and days in Excel?
Use DATEDIF with "y" for the years and "ym" for the months, then work out the days with =TODAY()-EDATE(A2,DATEDIF(A2,TODAY(),"m")). Microsoft advises against the "md" unit because it can return negative or wrong results.
How do I calculate age on a specific date in Excel?
Replace TODAY() with that date, built with the DATE function. For example, =DATEDIF(A2,DATE(2026,9,1),"y") gives the age on September 1, 2026. You can also point to a cell that holds the date.
Is DATEDIF available in my version of Excel?
Yes. Microsoft documents DATEDIF for every current version, from Excel 2016 to Microsoft 365, including Excel for Mac. Excel doesn't prompt for its arguments the way it does for most functions, so type the whole formula yourself.
Why does INT(YEARFRAC()) give the wrong age?
With basis 1, YEARFRAC divides by the average length of the calendar years in the span, so on some birthdays it returns a value just under the whole number, such as 25.998 instead of 26. INT then drops a year. Use DATEDIF for whole years.
Why does my age formula return #NUM! or #VALUE!?
#NUM! means the start date is later than the end date, usually a future birth date or swapped arguments. #VALUE! means Excel can't read one of the dates, usually because it's stored as text or is earlier than January 1, 1900.
How do I calculate age in Excel without DATEDIF?
Use =YEAR(TODAY())-YEAR(A2)-(DATE(YEAR(TODAY()),MONTH(A2),DAY(A2))>TODAY()). It subtracts one when this year's birthday hasn't happened yet, so it matches DATEDIF, including for February 29 birthdays.
Teach the Formula Once
Training a team on spreadsheets? Record the walkthrough once with Deckoholic's Chrome extension. It cuts the ums and pauses, adds zooms and captions, and exports an MP4 or a step-by-step help doc. There's a free plan.
Try Deckoholic Free