How to calculate age in years, months and days in Excel
Formula (Excel and Google Sheets)
=DATEDIF(B2,$F$1,"y")&" years, "&DATEDIF(B2,$F$1,"ym")&" months, "&DATEDIF(B2,$F$1,"md")&" days"Join three DATEDIFs: "y" for years, "ym" for the months left over and "md" for the days left over.
- 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
"y" counts complete years, "ym" the complete months after the last birthday, and "md" the days after the last monthly anniversary. Joining them with & builds the label. Mateo was born on December 30, so on October 29 he is 29 days past his September 30 monthly anniversary.
=DATEDIF(B2,$F$1,"y")&" years, "&DATEDIF(B2,$F$1,"ym")&" months, "&DATEDIF(B2,$F$1,"md")&" days"Result"7 years, 6 months, 17 days"
B24/12/2019The value in B2.
$F$110/29/2026The value in F1.
DATEDIF(B2,$F$1,"y")7DATEDIF: Difference in "Y", "M", "D", "YM", "MD" or "YD".- start_date
B24/12/2019 - end_date
$F$110/29/2026 - unit
"y"
- start_date
DATEDIF(B2,$F$1,"y")&" years, ""7 years, "The & operator joins as text.
DATEDIF(B2,$F$1,"ym")6DATEDIF: Difference in "Y", "M", "D", "YM", "MD" or "YD".- start_date
B24/12/2019 - end_date
$F$110/29/2026 - unit
"ym"
- start_date
DATEDIF(B2,$F$1,"y")&" years, "&DATEDIF(B2,$F$1,"ym")"7 years, 6"The & operator joins as text.
DATEDIF(B2,$F$1,"y")&" years, "&DATEDIF(B2,$F$1,"ym")&" months, ""7 years, 6 months, "The & operator joins as text.
DATEDIF(B2,$F$1,"md")17DATEDIF: Difference in "Y", "M", "D", "YM", "MD" or "YD".- start_date
B24/12/2019 - end_date
$F$110/29/2026 - unit
"md"
- start_date
DATEDIF(B2,$F$1,"y")&" years, "&DATEDIF(B2,$F$1,"ym")&" months, "&DATEDIF(B2,$F$1,"md")"7 years, 6 months, 17"The & operator joins as text.
DATEDIF(B2,$F$1,"y")&" years, "&DATEDIF(B2,$F$1,"ym")&" months, "&DATEDIF(B2,$F$1,"md")&" days""7 years, 6 months, 17 days"The & operator joins as text.
In Google Sheets
The same formula works in Google Sheets: =DATEDIF(B2,$F$1,"y")&" years, "&DATEDIF(B2,$F$1,"ym")&" months, "&DATEDIF(B2,$F$1,"md")&" days". 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 |
|---|---|---|
| =DATEDIF(B2,$F$1,"y")&" years, "&DATEDIF(B2,$F$1,"ym")&" months, "&$F$1-EDATE(B2,DATEDIF(B2,$F$1,"m"))&" days" | 7 years, 6 months, 17 days, 2 years, 9 months, 29 days, 6 years, 0 months, 0 days… | Counts the leftover days from the last monthly anniversary with EDATE, which avoids the "md" problem near month ends. |
| =DATEDIF(B2,$F$1,"y")&"y "&DATEDIF(B2,$F$1,"ym")&"m" | 7y 6m, 2y 9m, 6y 0m…Different result | A compact label without days, like 7y 6m. Years and months only. |
Common mistakes
- Microsoft warns that
"md"can give wrong results near month ends: from January 31 to March 1 it returns -2. If exact days matter, use the EDATE version. - The result is text, so you can't sort or average it. Keep a numeric age column,
DATEDIF(B2,$F$1,"y"), next to it. - Lock the as-of date as
$F$1, or each row points at a different cell when filled down.
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 in years, months and days
C2, show each child's age on the date in F1 as "7 years, 6 months, 17 days", and fill down to C6.Questions
How do I leave out "0 months" or "0 days"?
Wrap each part in IF, like IF(DATEDIF(B2,$F$1,"ym")=0,"",DATEDIF(B2,$F$1,"ym")&" months"), or join the parts with TEXTJOIN, which skips empty text.
How do I calculate it as of today?
Put =TODAY() in F1. The ages then update every day.
Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.