Dates and Times

How to Calculate Age From a Birthdate in Excel

Use DATEDIF to get a person's age in completed years and months from a birthdate, and avoid the year subtraction mistake that is off near birthdays.

On this page
  1. Why subtracting the years gives the wrong answer
  2. Years and months together
  3. Keep the age fixed as of a set date
  4. Blank birthdates and future dates
  5. When the age shows #VALUE!
  6. Where to go next

Use DATEDIF with the birthdate and today’s date. =DATEDIF(B2,TODAY(),“Y”) returns the number of completed years. Someone born on March 14, 1990, shows 35 until March 14, 2026, and 36 from then on.

DATEDIF doesn’t appear in Excel’s function list, but it works in current versions of Excel. Its arguments are a start date, an end date and a unit code: “Y” for completed years, “M” for completed months, and “D” for days.

Why subtracting the years gives the wrong answer

=YEAR(TODAY())-YEAR(B2) is tempting, but it counts calendar years, not completed years. Someone born on December 1, 1990, shows 36 on November 24, 2026, even though the birthday that makes them 36 is still a week away. DATEDIF shows 35 on that date and keeps showing 35 until December 1, 2026.

Years and months together

To show years and months, add a second DATEDIF with the “YM” unit. It returns the months left over after the last birthday:

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

You may see advice to use “MD” for the leftover days. Avoid it. The MD unit has known problems and can return wrong results.

Keep the age fixed as of a set date

TODAY() changes every day, so the age changes with it. For a report that should show the age on one date, put that date in a cell, such as E1, and use the cell in place of TODAY():

=DATEDIF(B2,$E$1,“Y”)

The dollar signs keep the reference to E1 fixed when you copy the formula down the column. That step is covered in how to lock cell reference in excel.

Blank birthdates and future dates

A blank birthdate counts as 0, which Excel treats as a date in 1900, so the age comes out very large. To show a blank instead, wrap the formula in IF:

=IF(B2=“”,“”,DATEDIF(B2,TODAY(),“Y”))

The IF check is covered in how to use if function in excel.

If the birthdate is later than the date it’s compared with, DATEDIF returns #NUM!. That usually means a typo, such as 2062 typed instead of 1962. How to clear that error is covered in how to fix #num error in excel. If you’d rather hide every error in the column, how to hide errors in excel formulas explains how, though it’s better to fix the entry first.

When the age shows #VALUE!

#VALUE! usually means the birthdate is text, not a date, even though it looks right on screen. The checks and fixes are in excel not recognizing dates as dates.

Where to go next

Once the formula works in one row, copy it down the list and check a few ages by hand. A quick check against a known birthday catches most mistakes.

The complete guide to dates and times

How to Work With Dates in Excel
Read the guide

Keep exploring

Guides from other topics

All topics →

How to Look Up Data in Excel

How lookups work in Excel, with VLOOKUP, XLOOKUP and INDEX with MATCH, how to set up your data, and how to choose the right function for the job.

Lookups 3 min read