How to Calculate Age in Excel: Formulas That Work

If you want to know how to calculate age in excel, the quick answer is to put the date of birth in one cell and use the formula =DATEDIF(A2, TODAY(), “y”), which returns the number of complete years. That one formula handles birthdays correctly, updates itself every day, and works in every modern version of Excel. The rest of this guide shows you how to get years, months, and days as well, how to find age on a specific date instead of today, and how to fix the errors that trip most people up. Once you have the formulas working, you can also cross-check any result on CalcuNexa’s free calculators if you want a second opinion without building a spreadsheet.

Why Simple Subtraction Gets Age Wrong

Why Simple Subtraction Gets Age Wrong

The tempting shortcut is to subtract the birth year from the current year, like =YEAR(TODAY()) minus YEAR(A2). The problem is that it ignores whether the birthday has happened yet this year. Someone born on 15 December 1990 would show as 36 all through 2026 with that formula, even though they do not turn 36 until December. That is an error of a full year for anyone whose birthday is still to come.

Dividing total days by 365.25 has a similar flaw. It looks clever, because it tries to allow for leap years, but it quietly misreports people born near month ends and on 29 February, and it gives a decimal that still has to be rounded correctly. Age is not a rounding problem. It is a completed years problem, and that is exactly what DATEDIF was built to solve.

The DATEDIF Formula, Explained

DATEDIF Formula, Explained

DATEDIF takes three arguments: a start date, an end date, and a unit code in quotation marks. Written out, it looks like =DATEDIF(start_date, end_date, unit). For age calculations, the start date is the date of birth, the end date is usually TODAY(), and the unit tells Excel what to count. The most useful unit codes are “y” for complete years, “m” for complete months, “ym” for the months left over after complete years, and “md” for the days left over after complete months.

One quirk surprises everyone the first time: DATEDIF does not appear in Excel’s function list or autocomplete. It is a legacy function kept for compatibility with older spreadsheets, so you have to type the full name yourself. It still works in Microsoft 365, Excel 2024, 2021, 2019, and 2016, on Windows and Mac, and in Excel for the web. Type it in full, with straight quotation marks around the unit code, and it will calculate normally.

Worked Example 1: Age in Complete Years

Worked Example 1

Suppose cell A2 holds the date of birth 15 March 1990, and today is 27 October 2026. Type this formula into B2:

=DATEDIF(A2, TODAY(), “y”)

Excel returns 36. That is correct, because the person turned 36 on 15 March 2026 and will not turn 37 until 15 March 2027. The “y” unit counts only birthdays that have fully passed, so nobody is ever aged a year early. If you copy the formula down a column of birth dates, every row gets its own correct age, and every age updates automatically the day after each birthday.

If you need the age on a fixed date instead of today, for example for a school admission cutoff or a pension calculation, replace TODAY() with a DATE value. To find the age on 1 January 2030, use =DATEDIF(A2, DATE(2030, 1, 1), “y”). For our example person, that returns 39, because they turn 40 in March 2030 but are still 39 on 1 January.

Worked Example 2: Age in Years, Months, and Days

Worked Example 2

Often you need more detail than whole years, for example for a child’s age, a visa form, or an HR record. Chain three DATEDIF calls together with the ampersand operator, which joins text in Excel:

=DATEDIF(A2, TODAY(), “y”) & ” years, ” & DATEDIF(A2, TODAY(), “ym”) & ” months, ” & DATEDIF(A2, TODAY(), “md”) & ” days”

For the same person, born 15 March 1990, measured on 27 October 2026, this returns “36 years, 7 months, 12 days”. Here is how it breaks down. The first call counts 36 complete years, landing on 15 March 2026. The “ym” call counts the complete months since then, from 15 March to 15 October, which is 7 months. The “md” call counts the remaining days, from 15 October to 27 October, which is 12 days. Each piece counts only what is complete, so the three parts never overlap or double count.

One caution belongs here. Microsoft’s own documentation warns that the “md” unit can return a negative number, zero, or an inaccurate result in some situations, so treat the days figure as a guide rather than gospel in edge cases like month end birthdays. The “y”, “m”, and “ym” units are the reliable ones, and they are the units Microsoft itself uses in its age examples. If the days part ever looks wrong for a particular birth date, check it against a calendar before relying on it.

Worked Example 3: A Second Person, Step by Step

Let us run a second example to make sure the pattern is clear. Cell A3 holds 4 July 1985, and again today is 27 October 2026.

First, complete years: =DATEDIF(A3, TODAY(), “y”) returns 41, because the person turned 41 on 4 July 2026. Next, the full breakdown: =DATEDIF(A3, TODAY(), “y”) & ” years, ” & DATEDIF(A3, TODAY(), “ym”) & ” months, ” & DATEDIF(A3, TODAY(), “md”) & ” days” returns “41 years, 3 months, 23 days”. The months run from 4 July to 4 October, which is 3 months, and the days run from 4 October to 27 October, which is 23 days.

Notice how the same formula shape works for both people. Once you have it right in one row, you can copy it down a whole list of birth dates and trust every row, because the formula adapts to each birth date rather than hard coding any numbers.

YEARFRAC: When You Need a Decimal Age

Sometimes a whole number is not enough. Insurance calculations, pro rata benefits, and some research work need age as a decimal, like 36.62 years. That is what YEARFRAC is for. The formula =YEARFRAC(A2, TODAY(), 1) returns the fraction of a year between the two dates, using basis 1, which means actual days counted against actual year lengths. For our first example person, it returns about 36.62 years on 27 October 2026.

If you only need whole years from YEARFRAC, wrap it in INT, like =INT(YEARFRAC(A2, TODAY(), 1)). That chops off the decimal and leaves 36. But for ordinary age work, DATEDIF with “y” is simpler and clearer, so save YEARFRAC for the cases where a decimal is genuinely required. A plain subtraction like =TODAY() minus A2 gives you total days lived, which is useful in its own right: our example person has lived 13,375 days by 27 October 2026, a figure you can verify by counting from the birth date.

Comparing the Methods

MethodFormulaBest forWatch out for
DATEDIF years=DATEDIF(A2, TODAY(), “y”)Everyday age in whole yearsHidden function, type it in full
DATEDIF full breakdownThree DATEDIF calls joined with &Years, months, and days“md” days can be unreliable at month ends
YEARFRAC=YEARFRAC(A2, TODAY(), 1)Decimal age for finance or researchReturns a fraction, wrap in INT for whole years
YEAR subtraction=YEAR(TODAY()) minus YEAR(A2)A rough estimate onlyWrong by a year before the birthday
Days divided by 365.25=INT((TODAY() minus A2) / 365.25)Quick and dirty estimatesMisreports leap year and month end birthdays

The table makes the choice simple. Use DATEDIF for real age work, YEARFRAC when a decimal is required, and treat the other two methods as rough checks only.

Fixing the Most Common Errors

A #NUM! error almost always means the end date comes before the start date, or one of the cells is not a real date. Check that the birth date is earlier than today, and check that Excel recognises it as a date rather than text. Dates stored as text sit left aligned in the cell and break formulas silently, so convert them first with Data, Text to Columns, or with =DATEVALUE(A2) if your locale format matches.

A #VALUE! error usually means a cell contains text that Excel cannot read as a date at all, or the unit code has curly quotation marks instead of straight ones. This happens often when a formula is copied from a web page, because web pages use curly quotes. Retype the quotation marks by hand in Excel and the error usually disappears.

A result of zero or a wildly wrong age often means the birth date cell actually holds a serial number displayed as something else, or the formula references the wrong cell. Click the birth date cell and check the formula bar: it should show a recognisable date. Also check that TODAY() is spelled correctly and that the workbook calculation is set to Automatic under Formulas, Calculation Options, so results refresh when the file opens.

Finally, remember that TODAY() recalculates whenever the workbook recalculates. That is usually what you want, since ages should update on birthdays. But if you need a frozen record, for example an age at application, replace TODAY() with the actual date or paste the result as values, so it never moves again.

Putting It All Together

For most jobs, one formula does the heavy lifting. Put birth dates in column A, type =DATEDIF(A2, TODAY(), “y”) in column B, and copy it down. Add the three part version in column C when you need years, months, and days, and reach for YEARFRAC only when a decimal age is required. Avoid year subtraction and division by 365.25 for anything that matters, and double check the “md” days figure at month ends.

If you want to sanity check a result without opening a spreadsheet, you can also cross-check on CalcuNexa’s free calculators, which give you a quick independent answer in seconds. And if you ever need to work out an age from a birth date on the go, that same free calculator collection is a handy shortcut. For spreadsheet work itself, though, the formulas above are all you need, and they will keep giving the right answer year after year, birthday after birthday.

Frequently Asked Questions

What is the simplest formula to calculate age in Excel?

The simplest reliable formula is =DATEDIF(A2, TODAY(), “y”), where A2 holds the date of birth. It returns complete years only, so it never ages someone a year early, and it updates automatically every day as TODAY() changes.

Why does DATEDIF not show up in Excel’s function list?

DATEDIF is a legacy compatibility function kept from older spreadsheet software, so Microsoft does not list it in the function menus or autocomplete. You have to type the full name yourself, with straight quotation marks around the unit code, but it works normally in all modern Excel versions once typed.

How do I calculate age in Excel in years, months, and days?

Join three DATEDIF calls with the ampersand operator: =DATEDIF(A2, TODAY(), “y”) & ” years, ” & DATEDIF(A2, TODAY(), “ym”) & ” months, ” & DATEDIF(A2, TODAY(), “md”) & ” days”. The first call gives complete years, the second gives leftover months, and the third gives leftover days.

How do I find someone’s age on a specific date, not today?

Replace TODAY() with the date you need, for example =DATEDIF(A2, DATE(2030, 1, 1), “y”) for the age on 1 January 2030. This is useful for admission cutoffs, pension calculations, and any record where the age must be frozen at one point in time.

Why does my age formula return #NUM! or #VALUE!?

A #NUM! error usually means the end date is before the birth date, or a cell holds text instead of a real date. A #VALUE! error usually means the date text cannot be read, or the quotation marks around the unit code are curly instead of straight. Retype the quotes by hand, convert text dates to real dates, and check that the birth date comes first.

For a detailed walkthrough of the DATEDIF function with more examples, see this DATEDIF guide. For a step by step beginner’s guide to age formulas, see this Excel age formula tutorial.

DATEDIF in Plain Terms

DATEDIF counts complete years only. Put the birth date in cell A2. Type the DATEDIF formula with the birth date cell first. Excel then returns the age in whole years. In addition, the result updates every day. TODAY() always supplies the current date. A birthday this year still counts only after it passes. The person born on 15 March 1990 is 36. Copy the formula down for every row.

Three DATEDIF calls give years, months, and days. Join them with the ampersand operator. For example, the first person is 36 years, 7 months, and 12 days. The second person, born on 4 July 1985, is 41. As a result, one formula shape serves every row. Avoid the md unit near month ends. Microsoft warns that md can return negative days. In practice, test the breakdown on known birthdays. A quick test builds trust in the sheet.

YEARFRAC and Errors in Plain Terms

YEARFRAC returns a decimal age instead. Use basis 1 for actual year lengths. For example, the first person measures about 36.62 years. Wrap the result in INT for whole years. In addition, decimal ages suit finance and research. YEAR subtraction gives only a rough estimate. It fails before the birthday each year. Days divided by 365.25 fails on leap birthdays. Choose DATEDIF for real age work.

A hash NUM error means the dates sit in the wrong order. Check that the end date follows the start date. For example, swap the two cells and retry. A hash VALUE error means Excel cannot read a date. As a result, check each cell format first. Text that looks like a date still fails. The formula may also reference the wrong cell. In practice, click the birth date cell and inspect it. Wild results often trace back to a serial number.

Putting Age Formulas to Work in Plain Terms

Put birth dates in column A. Type the DATEDIF formula in column B. For example, row 2 holds the first person. Row 3 holds the second person. In addition, copy the formula down the column. Every row then shows its own age. Replace TODAY() with a fixed date for cutoffs. School admissions often need a fixed date. The same shape works for any cutoff.

Cross-check a result without opening a spreadsheet. Use an independent calculator for a second opinion. For example, compare the calculator result with the sheet. Small mismatches usually mean a wrong cell. As a result, recheck the birth date first. TODAY() recalculates whenever the workbook recalculates. That behavior usually matches what you want. In practice, freeze a date when you need a record. A frozen date preserves the original answer.