How to calculate age from a date of birth in Excel
Formula (Excel and Google Sheets)
=DATEDIF(B2,$F$1,"y")Use =DATEDIF(birth_date, as_of_date, "y"). It returns completed years, so the age only goes up on the birthday.
- Result on the example
- one result per row in
C2, filled down toC6 - Works in
- Every current version
- Google Sheets
- Same formula
See it work
The formula is already in C2, filled down to C6. Change any input and the result updates, or edit the formula to experiment.
How it works
DATEDIF counts complete units between two dates; "y" means whole years. James turns 41 on November 2, so on October 29 he is still 40. Using a cell for the "as of" date keeps results stable; put =TODAY() in it for a live age.
=DATEDIF(B2,$F$1,"y")Result36
B25/4/1990The value in B2.
$F$110/29/2026The value in F1.
DATEDIF(B2,$F$1,"y")36DATEDIF: Difference in "Y", "M", "D", "YM", "MD" or "YD".- start_date
B25/4/1990 - end_date
$F$110/29/2026 - unit
"y"
- start_date
In Google Sheets
The same formula works in Google Sheets: =DATEDIF(B2,$F$1,"y"). We ran it in Google Sheets mode on the same data and it returns the same results.
Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =YEAR($F$1)-YEAR(B2)-(DATE(YEAR($F$1),MONTH(B2),DAY(B2))>$F$1) | 36, 40, 25… | Works without DATEDIF: subtract the years, then take one off if this year's birthday hasn't happened yet. |
| =INT(($F$1-B2)/365.25) | 36, 40, 24…Different result | A common shortcut, but it can be off by one around birthdays. Approximate. |
Common mistakes
- Subtracting years alone (
YEAR(F1)-YEAR(B2)) adds a year for everyone whose birthday is still to come. - DATEDIF is missing from Excel's autocomplete and help, but it works in every version and in Google Sheets.
- Dividing days by 365 drifts with leap years. Prefer DATEDIF.
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Calculate age from a date of birth
C2, calculate each person's age in completed years on the date in F1, and fill down to C6.Questions
How do I show age in years and months?
Combine two DATEDIFs: =DATEDIF(B2,F1,"y")&" years, "&DATEDIF(B2,F1,"ym")&" months".
How do I calculate age as of today?
Use =DATEDIF(B2,TODAY(),"y"). It updates every day.
Checked by running on 2026-10-29: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.