Home › Excel basics › Calculate age
Age Formula in Excel: Calculate Age from Date of Birth
The age formula in Excel is =DATEDIF(B2, TODAY(), "Y"): it returns someone's age in complete years from their date of birth, and updates automatically every day. Below are the variations you'll need, with examples.
In this guide
The age formula
| A | B | C | |
|---|---|---|---|
| 1 | Name | Date of birth | Age |
| 2 | Anna | May 20, 1990 | 36 |
| 3 | Ben | Dec 1, 1985 | 40 |
Ages shown as of November 12, 2026. DATEDIF counts complete years: Ben turns 41 on December 1, so until then he's 40. TODAY() makes the age update by itself. More about the function in the DATEDIF guide.
DATEDIF doesn't show up in autocomplete. It's a hidden function that works in every Excel version. Just type it in full.
Alternative: YEARFRAC
=INT(YEARFRAC(B2, TODAY(), 1))YEARFRAC returns the age as a decimal number (36.48 for Anna); INT drops the decimals. Use it if you prefer functions that appear in autocomplete, or if you actually want the decimal age.
Avoid =(TODAY()-B2)/365. It ignores leap years, so around a birthday it can be a day off and show the wrong age.
Try it yourself: age from a date of birth
Reading is one thing, typing it is another. Build the formula below step by step: the tips tell you what to type next, and you can click or drag across cells to add them, just like in Excel.
Task: Work out in C2 how old Sam is today: =DATEDIF(B2,TODAY(),"y")
Age in years and months
=DATEDIF(B2, TODAY(), "Y") & " years, " & DATEDIF(B2, TODAY(), "YM") & " months"Returns 36 years, 5 months for Anna. Useful for babies and young children, or for years of service. For the total in months only: =DATEDIF(B2, TODAY(), "M").
Age in years, months and days
Add a third DATEDIF with "MD" for the days left over after the last complete month:
=DATEDIF(B2, TODAY(), "Y") & " years, " & DATEDIF(B2, TODAY(), "YM") & " months, " & DATEDIF(B2, TODAY(), "MD") & " days"On November 12, 2026 this returns 36 years, 5 months, 23 days for Anna: her last complete month ended on October 20, and from there to November 12 is 23 days.
Microsoft warns that "MD" can give a wrong result in some cases, mostly around the end of a month. A safer way to get the leftover days: =TODAY()-EDATE(B2, DATEDIF(B2, TODAY(), "M")). EDATE moves the date of birth forward by the number of complete months; the subtraction counts what's left. If the cell shows a date, format it as Number.
Age on a specific date
Replace TODAY() with a date or a cell. Age at the start of the school year in C1:
=DATEDIF(B2, $C$1, "Y")Or with a fixed date: =DATEDIF(B2, DATE(2026, 9, 1), "Y"). See DATE.
Age groups
Put the age in column C and use IFS to assign a group:
=IFS(C2>=65, "65+", C2>=40, "40-64", C2>=18, "18-39", TRUE, "Under 18")To count how many people are in a group, use COUNTIFS: =COUNTIFS(C2:C100, ">=18", C2:C100, "<40").
Upcoming birthdays
- Birthday this month?
=MONTH(B2)=MONTH(TODAY())returns TRUE or FALSE. - Next birthday:
=DATE(YEAR(TODAY())+(TEXT(B2,"mmdd")<TEXT(TODAY(),"mmdd")), MONTH(B2), DAY(B2)) - Highlight birthdays this month with conditional formatting and the formula
=MONTH($B2)=MONTH(TODAY()).
Common mistakes
- #NUM!: the date of birth is in the future, or after the end date.
- #VALUE!: the date of birth is text, not a real date. Convert it first; see DATE.
- The age shows as a date (like 1/5/1900): the cell is formatted as a date. Change it to General or Number with Ctrl+1.
- An empty date of birth gives a huge age: wrap it:
=IF(B2="", "", DATEDIF(B2, TODAY(), "Y")).
More formulas
Copy a formula and change the ranges to match your own data.
| What you want | Formula |
|---|---|
| Age today in whole years | =DATEDIF(B2, TODAY(), "y") |
| Age on a fixed date (31 December 2026) | =DATEDIF(B2, DATE(2026, 12, 31), "y") |
| Age without DATEDIF | =INT(YEARFRAC(B2, TODAY(), 1)) |
| TRUE if someone is 18 or older | =DATEDIF(B2, TODAY(), "y")>=18 |
| The date someone turns 65 | =DATE(YEAR(B2)+65, MONTH(B2), DAY(B2)) |
Keep learning
Frequently asked questions
What is the formula to calculate age in Excel?
Use =DATEDIF(B2, TODAY(), "Y"), where B2 holds the date of birth. It returns the age in complete years.
How do I calculate age in years and months?
Combine two DATEDIFs: =DATEDIF(B2, TODAY(), "Y") & " years, " & DATEDIF(B2, TODAY(), "YM") & " months".
Why does my age formula show a date?
The result cell is formatted as a date. Format it as General or Number.
How do I calculate age without DATEDIF?
Use =INT(YEARFRAC(B2, TODAY(), 1)). It gives the same result in complete years.
How do I calculate age between two dates in two columns?
With the date of birth in B2 and the end date in C2: =DATEDIF(B2, C2, "Y"). If an empty end date should count as today: =DATEDIF(B2, IF(C2="", TODAY(), C2), "Y").
What happens with a birthday on February 29?
In years without February 29, DATEDIF counts the new year of age from March 1. Someone born on February 29, 2008 is still 17 on February 28, 2026 and turns 18 on March 1.
Does the age update by itself?
Yes. TODAY() recalculates whenever the workbook opens or changes, so the age goes up on the birthday. To keep the ages as they are today, copy the cells and use Paste Special › Values.