How to Calculate Age in Excel and Google Sheets (DATEDIF & YEARFRAC)

Need to work out ages for a list of employees, students or customers? Excel and Google Sheets can calculate age from a date of birth in a single formula. This guide covers the best methods — DATEDIF, YEARFRAC and simple subtraction — with copy-and-paste formulas, plus the pitfalls that trip people up. For a single person, our free age calculator is faster.

Method 1: DATEDIF (Recommended)

DATEDIF calculates the difference between two dates in years, months or days. With a date of birth in cell A2:

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

This returns completed years — exactly what most people mean by “age”. DATEDIF is a hidden legacy function in Excel: it doesn’t appear in autocomplete, but it works in every version, including Microsoft 365, and in Google Sheets.

UnitReturnsExample result
“Y”Complete years34
“M”Complete months412
“D”Total days12,545
“YM”Months after the last full year4
“MD”Days after the last full month17
“YD”Days since the last birthday138

Method 2: Age in Years, Months and Days

Combine units to produce a readable result:

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

This produces text such as 34 years, 4 months, 17 days. Microsoft notes that the “MD” unit can give inaccurate results in some edge cases at month ends; for critical work, cross-check with the age calculator.

Method 3: YEARFRAC

YEARFRAC returns the fraction of a year between two dates. Wrap it in INT to get completed years:

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

The final argument 1 tells Excel to use the actual number of days in each year, which handles leap years correctly. Without INT, YEARFRAC returns a decimal age like 34.37 — useful for statistics.

Method 4: Simple Subtraction (Use With Care)

=INT((TODAY()-A2)/365.25)

Dividing by 365.25 approximates leap years and is usually right, but it can be off by one on or near a birthday. Prefer DATEDIF or YEARFRAC whenever accuracy matters.

Age on a Specific Date

Replace TODAY() with a cell or a DATE function to find age on a cut-off date — for example, eligibility on 1 September 2026:

=DATEDIF(A2, DATE(2026,9,1), "Y")

Google Sheets

Every formula above works the same way in Google Sheets. Sheets also supports array formulas, so you can calculate an entire column at once:

=ARRAYFORMULA(IF(A2:A="", "", DATEDIF(A2:A, TODAY(), "Y")))

Common Errors and Fixes

  • #NUM! — the birth date is later than the end date. Check the order of arguments: start date first.
  • #VALUE! — the cell contains text, not a real date. Convert it with DATEVALUE or re-enter it in your locale’s date format.
  • Wrong by one year — you divided by 365 instead of using DATEDIF.
  • Result shows as a date — format the result cell as General or Number.
  • Ages change every day — that’s expected with TODAY(). Paste the results as values if you need a fixed snapshot.

Frequently Asked Questions

What is the formula to calculate age in Excel?
Use =DATEDIF(A2,TODAY(),”Y”), where A2 holds the date of birth. It returns the age in completed years.
Why can’t I find DATEDIF in Excel?
DATEDIF is an undocumented compatibility function, so it doesn’t show up in the formula suggestions. Type it manually and it will work.
How do I calculate age in months in Excel?
Use =DATEDIF(A2,TODAY(),”M”) for total completed months.
Does the age formula work in Google Sheets?
Yes. DATEDIF, YEARFRAC and TODAY all work in Google Sheets with the same syntax.
How do I calculate age between two dates in Excel?
Put the start date in A2 and the end date in B2, then use =DATEDIF(A2,B2,”Y”). You can also use our online date calculator.