fxExcelReps

← How-to guides

How to Calculate Age in Excel

Use =DATEDIF(B2, TODAY(), "Y") with the date of birth in B2. It counts complete years, so the age only goes up on the birthday itself. Subtracting the years (YEAR(TODAY())-YEAR(B2)) is wrong for everyone whose birthday hasn't come yet this year.

{"cells": {"A1": "Name", "A2": "Anna", "A3": "Ivan", "A4": "Maria", "B1": "Born", "B2": 30450, "B3": 33970, "B4": 37800, "C1": "Age", "C2": "=DATEDIF(B2,$F$2,\"Y\")", "C3": "=DATEDIF(B3,$F$2,\"Y\")", "C4": "=DATEDIF(B4,$F$2,\"Y\")", "D1": "Years + months", "D2": "=DATEDIF(B2,$F$2,\"Y\")\u0026\" y \"\u0026DATEDIF(B2,$F$2,\"YM\")\u0026\" m\"", "D3": "=DATEDIF(B3,$F$2,\"Y\")\u0026\" y \"\u0026DATEDIF(B3,$F$2,\"YM\")\u0026\" m\"", "D4": "=DATEDIF(B4,$F$2,\"Y\")\u0026\" y \"\u0026DATEDIF(B4,$F$2,\"YM\")\u0026\" m\"", "F1": "Today", "F2": 46358}, "focus": "C2", "formats": {"B2:B4": {"fmt": "date"}, "F2": {"fmt": "date"}}, "note": "F2 holds a fixed date so the example stays the same; in your file use TODAY()."}

Age in years

"Y" counts complete years between two dates.

=DATEDIF(B2, TODAY(), "Y")Age today.
=DATEDIF(B2, DATE(2026,12,31), "Y")Age at the end of 2026.

Years and months

"YM" gives the months left over after the full years.

=DATEDIF(B2, TODAY(), "Y")&" years, "&DATEDIF(B2, TODAY(), "YM")&" months"Like 35 years, 4 months.

Age with decimals

YEARFRAC returns years with a fraction, useful for averages.

=YEARFRAC(B2, TODAY())35.37, for example.

Common mistakes

#NUM! error
The date of birth is after the second date. Check that the dates are in the right order.
Ages are one year too high
You subtracted the years. Use DATEDIF, which waits for the birthday.

Frequently asked questions

Why can't I find DATEDIF in Excel?

It's a hidden function kept for compatibility: it works, but Excel doesn't suggest it as you type. See DATEDIF.

How do I calculate years of service?

The same formula with the start date: =DATEDIF(C2, TODAY(), "Y").

How do I count days between two dates?

Just subtract them. See days between dates.

Practise it

DATEDIFTODAYYEAR, MONTH, DAY

Think you know this?

15 formula tasks, no hints, with a leaderboard. Absolute, relative and mixed references included.

Take the Pro Challenge →

More how-to guides

How to Calculate Days Between Two Dates in Excel

Count days between two dates in Excel by subtracting them, count working days with NETWORKDAYS, and get months or years with DATEDIF.

How to Get the Last Day of the Month in Excel

Get the last day of a month in Excel with EOMONTH, plus the first day of the month, the number of days and the last working day.

How to Calculate Percentage Change in Excel

Calculate the percentage increase or decrease between two numbers in Excel with (new - old) / old, and format the result as a percent.

How to Calculate the Percentage of a Total in Excel

Calculate each row's share of a total in Excel with an absolute reference, so the formula works when copied down. Live example.