Cellgrids Cellgridsby LearnWithRinkesh
Home › Excel tutorials › How to Calculate Age in Excel with DATEDIF

How to Calculate Age from Date of Birth in Excel (DATEDIF Formula)

By Rinkesh Shah · Business Analyst, 8 years in data · Updated 2026-10-31

▶ Video coming soon

DATEDIF is a hidden Excel function that returns the gap between two dates in years, months or days. It does not appear in the function list, but it works.

Syntax

=DATEDIF(start_date, end_date, unit)

Age in years

With the date of birth in B2:

=DATEDIF(B2, TODAY(), "Y")

TODAY() updates every day, so the age stays current.

Years, months and days

=DATEDIF(B2,TODAY(),"Y")&" years, "&DATEDIF(B2,TODAY(),"YM")&" months, "&DATEDIF(B2,TODAY(),"MD")&" days"

Age on a fixed date

Replace TODAY() with a cell or a date, for example the date of an exam: =DATEDIF(B2, D1, "Y").

Common errors

Alternative

=INT(YEARFRAC(B2, TODAY())) also gives age in whole years. DATEDIF is easier to read in interviews, and it handles leap-year birthdays correctly.

Worked example

Birth date in A2 and today in B2. =DATEDIF(A2,B2,"Y") gives age in years. For years and months: =DATEDIF(A2,B2,"Y")&" years "&DATEDIF(A2,B2,"YM")&" months". Use TODAY() in place of B2 for live age.

Common mistakes

Frequently asked questions

Why is DATEDIF not in the function list?

It is an older compatibility function. Type it fully and it works.

What do the "Y", "M" and "D" units mean?

Complete years, months and days. "YM" gives months ignoring years, "MD" days ignoring months.

How do I get age without DATEDIF?

=INT(YEARFRAC(A2,TODAY())).

Practice this online, free

Reading is only half of learning Excel. Cellgrids is a free place for online Excel practice: solve Excel formula exercises in a live spreadsheet, prepare for Excel interview questions, and work through business case studies built for data analytics and business analytics roles.

Practice these formulas: DATEDIF, TODAY, YEARFRAC.

Start Excel practice → Case studies