Tabellab
Excel formulas

How to calculate age in Excel from a date of birth

To calculate age in completed years in Excel, use =DATEDIF(birth_date, TODAY(), "Y"). It counts the full years between the two dates, so someone born on 17 May 1988 is 38 on 30 October 2026 and turns 39 only on 17 May 2027. For a decimal age use =YEARFRAC(birth_date, TODAY(), 1), which returns 38.45 for the same person, and wrap it in INT for whole years. Avoid the quick formula =(TODAY()-birth_date)/365: the extra leap days push people up a year too early, so a man born on 31 October 1985 is shown as 41 the day before his 41st birthday, when he is still 40. The table below works through six birth dates, including a leap-day birthday and one that is today.

Updated 30 Oct 2026 7 min read By Tabellab team

DATEDIF syntax: start date, end date, unit

=DATEDIF(start_date, end_date, unit) returns the difference between two dates in the unit you choose. For age, the start date is the date of birth and the end date is the day you measure on: TODAY() for a live sheet, or a fixed cell such as a cut-off date for a report that must not change tomorrow. The unit is text in quotes:

"Y" counts completed years, the normal meaning of age. "M" counts completed months, useful for babies and for service in months. "D" counts days, the same as subtracting the dates. "YM" gives the months left over after the full years and "MD" the days left over after the full months. Combined, =DATEDIF(B2,$G$10,"Y")&" y "&DATEDIF(B2,$G$10,"YM")&" m" shows Anna as 38 y 5 m, and the MD part adds 13 days.

DATEDIF is an old compatibility function. Excel accepts it but does not suggest it while you type and does not show its arguments, so type it in full. The start date must not be after the end date, otherwise the result is #NUM!. Leave the dates as real dates, not text such as "17.05.1988" that Excel has not recognised.

Step by step: age today, next birthday and days to go

Put the dates of birth in column B and the date you measure on in one cell, here G10. The example fixes it at 30 October 2026 so the numbers on this page stay the same; in your own sheet you can write =TODAY() in that cell and every age updates daily.

1. Age in years: =DATEDIF(B2,$G$10,"Y"), filled down. The dollar signs keep the as-of cell fixed. Daniel, born 30 October 1990, is exactly 36 today, and Ben, born 31 October 1985, is still 40 because his birthday is tomorrow.

2. Next birthday: add one more year than the current age to the date of birth with EDATE: =EDATE(B2,12*(C2+1)). EDATE moves a date by whole months and handles month ends, so Chloe, born on 29 February 2000, gets 28 February 2027 in a year without 29 February. Wrap it in TEXT(…,"d mmm yyyy") to show it as a readable date, or format the cell as a date.

3. Days to go: subtract the as-of date from the next birthday: =EDATE(B2,12*(C2+1))-$G$10. Ben has 1 day left, Emma 16 days until she turns 18, and Daniel 365 because his birthday is today and the next one is a year away. If you want 0 on the birthday itself, wrap it in IF(DATEDIF(B2,$G$10,"YD")=0,0,…).

YEARFRAC for a decimal age

=YEARFRAC(start_date, end_date, basis) returns the fraction of years between two dates. With basis 1 (actual/actual) Excel uses the real number of days and the average length of the years involved, so leap years are taken into account: Anna is 38.45 years and Ben 40.998, just short of 41. Decimal ages are what you need for averages, for statistics or for anything priced per year of age.

For whole years, =INT(YEARFRAC(B2,TODAY(),1)) agrees with DATEDIF in almost every case. Leave out the basis and Excel uses basis 0, the 30/360 convention of US bond markets, which treats every month as 30 days and can be off by a few days around month ends. For ages always pass basis 1. The result of YEARFRAC is never rounded, so format it with two decimals or use ROUND if a report needs a fixed number of places.

Worked example: ages, next birthdays and checks for six people

Dates of birth and the as-of date are inputs (yellow). Every formula refers to the as-of date in G10; put =TODAY() there to make the sheet live.

Worked example: ages, next birthdays and checks for six people
ABCDEFG
1NameBirth dateAge (DATEDIF "Y")Years and monthsDecimal age (YEARFRAC)Next birthdayDays to go
2Anna17 May 19883838 y 5 m38.4517 May 2027199
3Ben31 Oct 19854040 y 11 m41.0031 Oct 20261
4Chloe29 Feb 20002626 y 8 m26.6728 Feb 2027121
5Daniel30 Oct 19903636 y 0 m36.0030 Oct 2027365
6Emma15 Nov 20081717 y 11 m17.9515 Nov 202616
7Felix03 Mar 19626464 y 7 m64.663 Mar 2027124
8
9Inputs and checksValue
10As-of date (a fixed date instead of TODAY(), so the example stays reproducible)30 Oct 2026
11Ben: quick formula INT((as-of − birth) ÷ 365), one year too high41
12Ben: DATEDIF age, correct (his birthday is tomorrow)40
13Anna: days since her last monthly anniversary (DATEDIF "MD")13
14Anna: age in completed months (DATEDIF "M")461
15Anna: age in days (as-of − birth)14,045
16Average age in completed years36.8
17People aged 18 to 64 on the as-of date5
18Emma: age on the cut-off date 31 Dec 202618
Key formulas
  • C2=DATEDIF(B2,$G$10,"Y")Age in completed years
  • D2=DATEDIF(B2,$G$10,"Y")&" y "&DATEDIF(B2,$G$10,"YM")&" m"Years and months as text
  • E2=YEARFRAC(B2,$G$10,1)Decimal age, actual/actual
  • F4=TEXT(EDATE(B4,12*(C4+1)),"d mmm yyyy")Next birthday of a leap-day birth
  • G3=EDATE(B3,12*(C3+1))-$G$10Days until the next birthday
  • G11=INT(($G$10-B3)/365)The quick formula that is one year too high
  • G18=DATEDIF(B6,DATE(2026,12,31),"Y")Age on a cut-off date

Fictional people and dates. DATEDIF, YEARFRAC and EDATE behave the same in Excel, Google Sheets and LibreOffice for these examples.

Why (TODAY() − birth date) / 365 goes wrong

Subtracting two dates gives the number of days between them, because Excel stores dates as serial numbers. Dividing by 365 looks like a natural conversion to years, but every leap year adds a day. Over 40 years there are about ten leap days, so the result runs roughly ten days ahead. For Ben, (30 Oct 2026 − 31 Oct 1985) ÷ 365 is 41.02 and INT turns that into 41, although his 41st birthday is tomorrow. Dividing by 365.25 is closer but still wrong for some birthdays around the anniversary. DATEDIF and YEARFRAC compare calendar dates instead of dividing days, which is why they get the birthday exactly right.

The same day count is still useful when you really want days: Anna has lived 14,045 days on 30 October 2026, the same as DATEDIF(B2,$G$10,"D").

Age on a cut-off date, age groups and averages

Schools, sports clubs and insurance tables often ask for the age on a fixed date, not today. Replace TODAY() with that date: =DATEDIF(B6,DATE(2026,12,31),"Y") gives Emma 18 on 31 December 2026, although she is 17 today. Keep the cut-off in its own cell if more than one formula uses it.

Once the ages are in a column, the usual functions work on them. =AVERAGE(C2:C7) gives the average completed age, 36.8 for the six people. =COUNTIFS(C2:C7,">=18",C2:C7,"<=64") counts the people aged 18 to 64, five here because Emma is 17. For age bands such as 18–24 or 25–34 use a small band table with an approximate lookup, or IFS on the age column, rather than typing the bands into many nested IFs.

Which function to use: DATEDIF "Y" for the age people expect to see, DATEDIF "Y", "YM" and "MD" when you need years, months and days, and YEARFRAC with basis 1 when you need a decimal age for calculations.

Common mistakes

  • Dividing the days by 365. Leap days make the result run ahead, so people are shown a year older shortly before their birthday. Use DATEDIF with "Y" or INT(YEARFRAC(…,1)).
  • Leaving out the YEARFRAC basis. Without basis 1, YEARFRAC uses 30/360 and can be off around month ends. Always write YEARFRAC(birth, date, 1) for ages.
  • Start date after end date. DATEDIF returns #NUM! if the birth date is later than the as-of date, often a sign of a typo or a swapped column.
  • Birth dates stored as text. Dates typed in a format Excel does not recognise stay text, and DATEDIF returns #VALUE!. Convert them with DATEVALUE or Text to Columns first.
  • Using TODAY() in a report that must not change. TODAY() recalculates every day. For an official list, put the cut-off date in a cell and refer to it.
  • Trusting the "MD" unit blindly. The leftover-days part of DATEDIF can give odd results around month ends, for example for birthdays on the 31st. Check those rows, or show years and months only.

Frequently asked questions

What is the formula to calculate age in Excel?

Use =DATEDIF(A2,TODAY(),"Y") with the date of birth in A2. It returns the age in completed years. For a decimal age use =YEARFRAC(A2,TODAY(),1).

How do I calculate age in years and months in Excel?

Combine two DATEDIF units: =DATEDIF(A2,TODAY(),"Y")&" years "&DATEDIF(A2,TODAY(),"YM")&" months". Add DATEDIF(A2,TODAY(),"MD") for the remaining days.

Why is DATEDIF not in the Excel function list?

DATEDIF is kept for compatibility with older spreadsheet programs and is not shown by AutoComplete, but it works. Type the whole formula, including the unit in quotes.

How do I calculate age on a specific date in Excel?

Replace TODAY() with the date or a cell that holds it, for example =DATEDIF(A2,DATE(2026,12,31),"Y") for the age on 31 December 2026.

How does Excel handle a birthday on 29 February?

DATEDIF counts the year as complete on 1 March in non-leap years, and EDATE moves the anniversary to 28 February. Decide which date your rules use and stay consistent.

Practise it in a lab

Related guides

Reading is step one. Doing is step two.

Every guide links to a lab where you build the same calculation in an online spreadsheet and get instant feedback.

Open the lab