How to Calculate Age Difference in Excel

An age difference is the gap between two birth dates, so it is a span rather than an age. That single change of framing settles most of the confusion: you are measuring the distance between two dates, not comparing two people's ages.

The formulas below give the gap in years and months, decide who is older, and — the part that catches people out — compare two gaps against each other without losing the months in rounding.

The Gap in Years and Months

Put the older birth date in A2 and the younger one in B2, then:

=DATEDIF(A2,B2,"Y") & " years " & DATEDIF(A2,B2,"YM") & " months"

The order of the two references is not decorative. DATEDIF requires the earlier date first and returns #NUM! if you reverse them, so an unsorted column of birth dates will fail on some rows and work on others.

Worked Example: Two Couples, Two Gaps

Two comparisons measured on the same reference date:

PairOlderYoungerGap
Couple A10 Jan 19882 Nov 19957 years 9 months
Couple B15 Jun 199022 Sep 19933 years 3 months

Couple A: 10 January 1988 plus 7 years reaches 10 January 1995, plus 9 months reaches 10 October 1995, and 23 more days lands on 2 November 1995. Couple B: 15 June 1990 plus 3 years reaches 15 June 1993, plus 3 months reaches 15 September 1993, and 7 more days is 22 September 1993.

In whole days the two gaps are 2,853 and 1,195 — a difference of 1,658 days, or about 4 years and 6 months. That figure is exactly what you lose if you compare only the rounded year counts and conclude "7 versus 3 years".

Deciding Who Is Older

To label the older person without sorting the list, compare the dates directly:

=IF(A2<B2, "Person 1 is older", IF(A2>B2, "Person 2 is older", "Same date"))

Earlier date means older person, which is the reverse of how the comparison reads at a glance. The third branch handles identical birth dates, a case that quietly breaks formulas written with only two outcomes.

The Mistake: Subtracting Two Ages

The tempting shortcut is to compute each person's age in years and subtract one from the other. It is wrong twice over: each age has already been rounded down, so the subtraction can be out by a year, and the months that distinguish two similar gaps disappear entirely.

If you need a single comparable number, work in days rather than years. Holding four birth dates — A2 and B2 for the first pair, D2 and C2 for the second — the distance between the two gaps is:

=ABS((B2-A2) - (D2-C2))

That returns the difference between the two gaps in days, with no rounding anywhere. Divide by 365.25 if you want it back in years, or leave it in days and format the result as a number.

Decimal Ages With YEARFRAC

For charts and statistics, a decimal age is often more useful than a whole number:

=YEARFRAC(A2, B2, 1)

The basis argument of 1 means actual/actual: real days over a real year length. Omit it and Excel falls back to basis 0, a 30/360 convention from bond pricing that treats every month as thirty days — helpful for financial accrual, wrong for people.

One caution: decimal ages are excellent for plotting and misleading for statements. "A gap of 4.54 years" is precise and almost never what a reader wants; "4 years and 6 months" is what they will repeat to someone else.

Gaps Between Events, Not People

Nothing in these formulas is specific to birth dates. The same subtraction measures the interval between two project milestones, the distance between two releases, or the time between two diagnoses. The only requirement is that both cells hold real dates.

If your sheet stores ordinal dates such as "3rd of March" as text for display, the arithmetic will not work. Keep a real date column alongside the display column, and calculate from the hidden real dates.

A Short Checklist Before You Trust the Gap

The last point matters for anything you might publish. A gap that depends on TODAY() changes every time the file opens, so a figure quoted from a spreadsheet should always record the date it was read.

Enter two birth dates and get the exact gap in years, months and days.

Open the Age Difference Calculator →

Frequently Asked Questions

Can Excel calculate the age difference between two people directly?

Yes. Subtract the two birth dates for a day count, or use DATEDIF with the Y and YM units to express the gap as years and months. There is no dedicated function for it.

Why does DATEDIF return #NUM! for some rows?

Because the first argument is later than the second. Sort or guard the references so the earlier birth date always comes first.

How do I know which person is older?

Compare the two dates: the earlier date belongs to the older person. An IF test can label the result, and it needs a third branch for identical dates.

Can I compare two age gaps with each other?

Yes, but do it in days or decimals. Subtracting two rounded year figures loses the months and can be out by a whole year, so compute each gap in days first.

What does YEARFRAC with basis 1 mean?

It counts actual elapsed days against an actual year length. Omitting the argument uses a 30/360 financial convention that treats every month as thirty days, which is wrong for ages.

How do I show the gap in months only?

Use the M unit. DATEDIF with the unit "M" returns completed calendar months between the two dates, which is handy for comparing small differences precisely.

Does the formula work if the two people have the same birthday?

It returns zero for the years and months, so you need an explicit test for equality if you want a label such as "same date" rather than "0 years 0 months".

Why does my result show a date in 1900?

The cell inherited a date format. The value is a correct day count; set the format to General or Number to see it as a number.

Can I use these formulas for non-birth dates?

Yes. Anything stored as a real date can be subtracted. The arithmetic is about the two dates, not about people, so project milestones work the same way.

Are the dates I enter on this site kept private?

Yes. Everything runs in your browser — nothing is sent to a server and nothing is saved.

Sources

Further Reading

About the Author

AgeGapCalc Team

A small independent team building free, private, browser-based age and date calculators. This article was compiled from public calendar references, listed in the Sources section above and reflects the team’s own method and experience. All figures are computed with calendar-based date arithmetic; nothing is uploaded.