Age Difference Calculator
Updated June 12, 20263 min read

How to Calculate Age Difference in Excel and Google Sheets

Step-by-step formulas to calculate exact age difference in Excel using DATEDIF. Avoid the secret bug that produces completely wrong results.

You are staring at two columns of birth dates in Excel, trying to figure out how to calculate the exact age difference between them. Simple subtraction gives you a messy decimal, and trying to manually divide by 365 leaves you with inaccurate numbers that ruin your data. Frustration sets in when you realize Excel does not even autocomplete the function you need. The math is actually pretty simple once you know the hidden formula. Here is the exact formula you need to get perfectly clean years, months, and days.

The Secret Core Formula

If you need an age difference calculator built right into Excel or Google Sheets, the tool you want is DATEDIF.

Put the earlier date in cell A1 and the later date in cell B1. Then type these exactly:

=DATEDIF(A1, B1, "y") → returns whole years =DATEDIF(A1, B1, "ym") → returns leftover months =DATEDIF(A1, B1, "md") → returns leftover days

To string it all together into a beautiful, readable sentence like "5 years, 8 months, 13 days", just combine them like this:

=DATEDIF(A1,B1,"y") & " years, " & DATEDIF(A1,B1,"ym") & " months, " & DATEDIF(A1,B1,"md") & " days"

The best part? This works identically in Google Sheets. The function name and arguments translate perfectly.

Finding Total Units Instead of Breakdowns

Sometimes you just want the gap measured in a single massive unit, rather than breaking it down. To get total counts:

=DATEDIF(A1, B1, "d") → total raw days =DATEDIF(A1, B1, "m") → total whole months =(B1 - A1) → plain subtraction also gives total days

The Famous Microsoft Bug

The "md" argument — the one that calculates leftover days — has a long-documented bug inside Excel. In very specific leap-year and month-end scenarios, it will actually return a negative number or a clearly wrong result.

If precision is absolutely critical for official records, do not trust the "md" argument blindly. Always verify your results against a reliable logic system.

Skip the Spreadsheet Altogether

If you only need to calculate one or two age gaps, don't fight with formulas. Let our tool handle leap years instantly.

Calculate Age Difference

When You Should Abandon Excel

If this is just a one-off project and you are trying to find the age difference between siblings or a romantic partner, skip the spreadsheets.

Our Age Difference Calculator does the exact same years-months-days math instantly. It automatically corrects for leap years and weird month lengths without the Microsoft bugs. If you just need to know how old someone is today, use the standard Age Calculator.

DATEDIF is the correct spreadsheet answer. Just remember to put the earlier date first and watch out for the leftover days glitch.

Ready to run the numbers?

Get your result instantly — private, in your browser.

Open the calculator →