How to calculate age in years and months
✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)Show an exact age (or tenure) as "X years, Y months" rather than just years.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel (desktop) | =DATEDIF(A2,B2,"Y")&" years, "&DATEDIF(A2,B2,"YM")&" months" | A2=start/birth date, B2=end date (use TODAY() for current age). |
| Google Sheets | =DATEDIF(A2,B2,"Y")&" years, "&DATEDIF(A2,B2,"YM")&" months" | Identical. |
| LibreOffice Calc | =DATEDIF(A2,B2,"Y")&" years, "&DATEDIF(A2,B2,"YM")&" months" | Identical. |
How it works
DATEDIF with "Y" gives complete years; "YM" gives the leftover months after those years are subtracted โ together they make "34 years, 5 months" for a birthdate of Feb 10, 1992 as of July 21, 2026. Add DATEDIF(...,"MD") for leftover days if you want all three parts. DATEDIF is undocumented in Excel's function wizard but works in all three apps โ a survivor from Lotus 1-2-3 compatibility.
Verified, not just documented
We ran =DATEDIF(DATE(1992,2,10),DATE(2026,7,21),"Y")&" years, "&DATEDIF(DATE(1992,2,10),DATE(2026,7,21),"YM")&" months" in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 34 years, 5 months — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 34 years, 5 months for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.
Functions used
DATEDIF — see full Excel, Google Sheets & LibreOffice compatibility for each.
Related recipes
- How to calculate age in years from a birth date
- How to calculate the number of days between two dates
- How to calculate the number of months between two dates
- How to calculate the next birthday (or anniversary) date