Formula Fixer

Calculate Age in Excel and Google Sheets

Updated 2026-11-17

TL;DR: Put the date of birth in A2 and use =DATEDIF(A2,TODAY(),"Y") for age in whole years. Add "YM" for the extra months and "MD" for days (Microsoft warns "MD" can be inaccurate). Use =YEARFRAC(A2,TODAY(),1) for a decimal age and swap TODAY() for a date to get age on a specific day. Avoid (TODAY()-A2)/365, which drifts with leap years.

Working out age sounds simple until you hit leap years, birthdays later in the year and people born on 29 February. DATEDIF handles all of this in one short formula, in both Excel and Google Sheets.

Calculate age from date of birth

Put the date of birth in A2 as a real date (it should right-align in the cell; if it left-aligns, it is text). Then:

You wantFormula (date of birth in A2)Result for 14/03/1990 on 17/11/2026
Age in whole years=DATEDIF(A2,TODAY(),"Y")36
Years and months=DATEDIF(A2,TODAY(),"Y")&" years "&DATEDIF(A2,TODAY(),"YM")&" months"36 years 8 months
Years, months and days=DATEDIF(A2,TODAY(),"Y")&"y "&DATEDIF(A2,TODAY(),"YM")&"m "&DATEDIF(A2,TODAY(),"MD")&"d"36y 8m 3d
Age as a decimal=YEARFRAC(A2,TODAY(),1)about 36.68
Age on a fixed date (31 Dec 2026)=DATEDIF(A2,DATE(2026,12,31),"Y")36
Total days alive=TODAY()-A213,397

DATEDIF counts complete units: “Y” is whole years, “YM” is months left over after whole years, and “MD” is days left over after whole months. The start date must be earlier than the end date, or DATEDIF returns #NUM!.

Why does DATEDIF not appear in Excel's function list?

Excel keeps DATEDIF for compatibility with older Lotus 1-2-3 workbooks, so it does not show up in formula autocomplete. Type it in full and it works. Microsoft's help page warns that the “MD” unit has known limitations and can return a negative number or a wrong result, so use it for display, not for anything important. Google Sheets lists DATEDIF normally.

Why not just divide by 365?

=(TODAY()-A2)/365 ignores leap days, so it slowly overstates age and can tick someone over to their next year a few days before their birthday. =INT((TODAY()-A2)/365.25) is closer but can still be a day out around birthdays. DATEDIF and YEARFRAC with basis 1 count real calendar years.

Age on a specific date

Replace TODAY() with a date or a cell. Age on 31 December 2026, for example for a school year cut-off or an insurance form:

=DATEDIF(A2,DATE(2026,12,31),"Y")

For a list of people with an event date in column B, use =DATEDIF(A2,B2,"Y") and fill down.

Next birthday and days until it

Next birthday:
=DATE(YEAR(TODAY())+(DATE(YEAR(TODAY()),MONTH(A2),DAY(A2))<TODAY()),MONTH(A2),DAY(A2))

Days until next birthday:
=C2-TODAY()

Age they will turn:
=DATEDIF(A2,TODAY(),"Y")+1

Put the first formula in C2 and format it as a date. For someone born on 29 February, DATE(2027,2,29) rolls over to 1 March 2027 in both Excel and Google Sheets, so non-leap-year birthdays show as 1 March. For more countdowns see our countdown formula guide.

Group people by age band

Once you have ages in column D, IFS sorts them into bands:

=IFS(D2<18,"Under 18",D2<30,"18-29",D2<50,"30-49",D2<65,"50-64",TRUE,"65+")

Then count each band with COUNTIF or a pivot table. More on conditions in IF, AND, OR and IFS.

Common errors

Quick FAQ

What is the formula to calculate age in Excel? =DATEDIF(A2,TODAY(),"Y"), with the date of birth in A2. It returns age in complete years.

How do I calculate age in years and months? Join two DATEDIF results: =DATEDIF(A2,TODAY(),"Y")&" years "&DATEDIF(A2,TODAY(),"YM")&" months".

Does DATEDIF work in Google Sheets? Yes, with the same arguments, and it appears in Sheets' function suggestions.

How do I calculate age as of a certain date? Replace TODAY() with that date, for example =DATEDIF(A2,DATE(2026,12,31),"Y").

Why is my age formula one year off? You are probably dividing days by 365. Use DATEDIF or YEARFRAC with basis 1, which count real calendar years.

More date maths: days between dates and working days with NETWORKDAYS.

Sources: Microsoft Support: DATEDIF function; Microsoft Support: YEARFRAC function; Google Docs Editors Help: DATEDIF.

Prefer a ready-made file?

Templates we sell: see all downloads and prices.

← More guides