
How Do You Calculate Age in Excel?
Carlos GarciaPublished How Do You Calculate Age in Excel?
There is a short answer to this, and it works. There is also a much longer story behind it, which is that the function almost everyone uses to calculate age in Excel is one Microsoft keeps at arm's length, and the function Microsoft recommends on its own dedicated age page is not that function at all.
That gap matters more than it sounds. If you are calculating ages for a payroll file, an eligibility check, an insurance band or a compliance report, the difference between a formula that is right most of the time and a formula that is right on every single row is the difference between a working spreadsheet and a quiet, invisible error that someone finds eighteen months later.
How Do You Calculate Age in Excel? The Direct Answer
Put the date of birth in a cell, then use DATEDIF with the "Y" unit and TODAY() as the end date. If the birth date is in B2, the formula is =DATEDIF(B2,TODAY(),"Y"), and it returns a whole number: completed years of age as of today.
That is the formula to use when you want the number a person would give you if you asked how old they are. It counts completed years, so someone born on March 1 turns a year older on March 1 and not a day before, which is the behavior almost every real-world use of age requires.
Microsoft's own documentation for the function says plainly that DATEDIF "is useful in formulas where you need to calculate an age," so this is not a community workaround being passed off as official. It is a documented use of a documented function.
The syntax Microsoft publishes is DATEDIF(start_date,end_date,unit), with all three arguments required. The order matters: the earlier date goes first. Put the birth date second and the formula does not return a negative age, it returns an error instead.
If you want age in years and months rather than whole years, you can combine two units in one formula: =DATEDIF(B2,TODAY(),"Y")&" years, "&DATEDIF(B2,TODAY(),"YM")&" months". The "YM" unit returns the leftover months after the whole years have been counted.
Running a spreadsheet your business actually depends on? Get a free SEO audit and we'll show you where the rest of your data work is leaking value.
Free audit
Where do you stand in AI search?
A manual SEO + AI search audit of your site: how ChatGPT, Gemini, Perplexity and Claude read and cite it today, and what to fix first. Report within 48 hours, no credit card.
Get my free auditOr have it all done: AI SEO services, $999 once
What Is DATEDIF, and Why Does Microsoft Half-Disown It?
DATEDIF calculates the number of days, months or years between two dates. Microsoft's own one-line description of it is exactly that: "Calculates the number of days, months, or years between two dates." It is a date-difference function, and age is simply the most common thing people use it for.
The odd part is why it exists at all. Microsoft's documentation states the reason outright: "Excel provides the DATEDIF function in order to support older workbooks from Lotus 1-2-3." It is a compatibility function, inherited from a competitor's spreadsheet that stopped being a competitor decades ago, and it survives because too many files depend on it.
That inheritance shows in how Microsoft talks about it. The page carries a warning that "The DATEDIF function may calculate incorrect results under certain scenarios," which is an unusual thing for a vendor to say about its own function in the first paragraph of its own reference page.
The six unit arguments, and the one Microsoft warns against
The unit argument is a text string in quotation marks, and it accepts exactly six values. Microsoft's own descriptions of each are worth having in front of you, because three of them do something less obvious than they look:
"Y"returns "The number of complete years in the period." This is the age unit."M"returns "The number of complete months in the period.""D"returns "The number of days in the period.""MD"returns "The difference between the days in start_date and end_date. The months and years of the dates are ignored.""YM"returns "The difference between the months in start_date and end_date. The days and years of the dates are ignored.""YD"returns "The difference between the days of start_date and end_date. The years of the dates are ignored."
One of those six carries an explicit health warning. Microsoft states: "We don't recommend using the 'MD' argument, as there are known limitations with it." The known-issues section is more specific: "The 'MD' argument may result in a negative number, a zero, or an inaccurate result."
That is the single most important thing to take from Microsoft's page. If you are building the familiar three-part breakdown of years, months and days, the days component is the part Microsoft is telling you not to build that way. A separate Microsoft page repeats the advice in different words, recommending against the "md" argument because it may calculate inaccurate results.
The "undocumented function" claim is not Microsoft's claim
You will read in a great many places that DATEDIF is a hidden or undocumented function that does not appear in Excel's function list. Microsoft's own pages do not say that anywhere, and they contradict the spirit of it: DATEDIF is listed in Microsoft's own Excel functions-by-category catalog with the same one-line description as its reference page.
What Microsoft's documentation genuinely does not address is autocomplete. There is no statement on the DATEDIF page, or on its companion date-difference page, about whether the function appears in formula autocomplete or the Insert Function dialog. That is an absence, not a denial, and it is worth separating from the much stronger claim that the function is undocumented.
The supported-versions list is equally concrete and equally worth checking against your own environment. Microsoft documents DATEDIF for Excel for Microsoft 365 on Windows and Mac, Excel for the web, Excel 2024, 2021, 2019 and 2016, and Windows SharePoint Services 3.0.
How Do You Build the Age Formula, Step by Step?
Step 1: Put the birth date in its own cell and confirm Excel sees it as a date. Type the date and look at the alignment. Excel right-aligns real dates and left-aligns text that merely looks like a date. If it is left-aligned, DATEDIF has nothing to calculate from and the formula will fail.
Step 2: Decide what "today" means for this file. TODAY() is the right answer for a live dashboard where the age should always be current. A hard-coded date is the right answer for a report that has to show the same numbers to everyone who opens it, forever.
Step 3: Write the formula with the birth date first. In a new column, enter =DATEDIF(B2,TODAY(),"Y"). Keep the unit in double quotation marks. Without them, Excel reads Y as an undefined name rather than a text argument and the formula breaks.
Step 4: Fill it down and check the first and last rows by hand. Pick two rows where you can work the age out in your head, ideally one person whose birthday has already passed this year and one whose has not. If both are right, the formula is handling the year boundary correctly.
Step 5: Format the result as a number, not a date. This catches more people than it should. The cell you put the formula in may inherit a date format from the column beside it, and an age of 34 will then render as a date in early 1900 rather than as the number 34.
Step 6: Add the months component only if you need it, and build the days component differently. Use "YM" for leftover months. For leftover days, do not reach for "MD", because that is the argument Microsoft recommends against. Build the day count from a date subtraction instead.
Step 7: Handle the empty rows. A blank birth-date cell is read as zero, which Excel interprets as January 0, 1900, and your formula will confidently report an age of 126. Wrap it: =IF(B2="","",DATEDIF(B2,TODAY(),"Y")).
That last step is the one that separates a formula that works on your test data from a formula that survives contact with a real file. Every real list of people has gaps in it, and an age column that silently reports 126 for every missing birth date is worse than one that reports nothing at all, because the number looks like data.
Spreadsheet work is only one place accuracy pays off. Request a free audit and we'll tell you what's quietly costing you traffic.
Why Does Microsoft's Own Age Page Never Use DATEDIF?
Here is the finding that should change how you read every other guide on this topic. Microsoft publishes a dedicated support page titled "Calculate age," which opens by saying "Excel can help you calculate the age of a person in different ways." It demonstrates ten formulas. Not one of them uses DATEDIF.
The approaches it shows instead are subtracting years directly with =(YEAR(NOW())-YEAR(A2)), taking a fractional year with =YEARFRAC(A3,A5), and dividing a day count by 365.25 with =(A5-A6)/365.25. The page also demonstrates DAYS, NETWORKDAYS, DAYS360 and EDATE for related date problems.
So Microsoft has two pages that both speak to age, and they do not agree with each other. The DATEDIF reference page says the function is useful for calculating an age. The dedicated age page calculates age four other ways and never mentions it. Neither page acknowledges the other's approach.
The practical reading is that DATEDIF with "Y" remains the most accurate single formula for completed years, and that Microsoft's age page is showing a range of date arithmetic rather than recommending a best method. But you should know the disagreement exists, because it explains why guidance on this topic is so inconsistent everywhere else.
It also means the =(YEAR(NOW())-YEAR(A2)) pattern carries a Microsoft example behind it, which is unfortunate, because it is wrong for age roughly half the time. It subtracts birth year from current year and ignores the month and day entirely, so everyone whose birthday has not yet happened this year comes out a year too old.
That formula has a legitimate use: it answers "what year-group is this person in," which is a real question in school cohorts and actuarial bands. It just is not age, and the distinction is invisible in a spreadsheet until someone checks a row.
What Does YEARFRAC Do Differently?
YEARFRAC is the function Microsoft's age page reaches for when it wants a decimal age rather than a whole number. Its published description is that it "calculates the fraction of the year represented by the number of whole days between two dates."
The syntax is YEARFRAC(start_date, end_date, [basis]), and the optional third argument is where the behavior lives. Microsoft describes basis as "The type of day count basis to use," and documents five values: 0 or omitted for US (NASD) 30/360, 1 for actual/actual, 2 for actual/360, 3 for actual/365, and 4 for European 30/360.
Those are day-count conventions borrowed from the bond market, and the default is the one most likely to surprise you. Basis 0 treats every month as having 30 days and every year as having 360. Microsoft's own implementation notes for the ECMA-376 standard spell out the adjustments: a date falling on February 28 or 29 is adjusted to a notional thirtieth of February, and in months with 31 days, "all dates with a day value of 31 are changed to day 30."
For age, basis 1 is the honest choice, because it counts real days. Microsoft documents it as "Actual/actual. The actual number of days between the two dates are counted," with the year treated as 366 days where the span includes a leap day and 365 days where it does not.
Even then there is a wrinkle worth knowing, and Microsoft publishes it: "In Office, if the argument basis is Actual/actual, the year length used is the average length of the years that the range crosses, regardless of where arguments start-date and end-date fall in their respective years." Averaging year lengths across a span is a reasonable thing for a bond calculation to do and a slightly strange thing for a human age to do.
Two more documented behaviors matter in practice. Microsoft states that for YEARFRAC, "All arguments are truncated to integers," so any time component in your dates is discarded. And if basis is less than 0 or greater than 4, the function returns a #NUM! error rather than falling back to a default.
If you wrap it in INT() to get whole years, =INT(YEARFRAC(B2,TODAY(),1)), you get something very close to DATEDIF with "Y". Close, but produced by a different route, with the averaging behavior above sitting underneath it.
Where Does the 365.25 Shortcut Break?
The third approach on Microsoft's age page is the one you have probably seen scrawled in a spreadsheet somewhere: subtract the dates and divide. Microsoft shows it as =(A5-A6)/365.25, and the 0.25 is there to account for leap years.
It is arithmetic dressed as a calendar. The average Gregorian year is not 365.25 days long, it is 365.2425, because century years are not leap years unless they divide by 400. Over a human lifespan the drift from that difference is small, but it is a drift in a fixed direction rather than noise that cancels out.
The sharper problem is not the drift, it is the rounding. Divide a day count by 365.25 and you get a decimal that is very slightly below the true age for some birth dates and very slightly above for others, depending on how many leap days the span happens to contain. Floor that number to get whole years and a handful of rows will flip a year early or a year late.
Which rows flip depends on the combination of birth date and today's date, so the error moves around as the file ages. A spreadsheet that reconciles perfectly in March can have three wrong rows in September, with no edit having been made to it. That is the worst kind of error to have in a recurring report.
The variant you also see, dividing by a flat 365, is worse in a predictable direction: it ignores leap days entirely, so it overstates age, and the overstatement grows with the length of the span.
None of this makes the shortcut useless. For a rough bucket, a rounded average or a sanity check on a big list, dividing by 365.25 is perfectly serviceable and faster to read than a nested function. Just do not put it in a column that someone will treat as the authoritative age of a named person.
When Is Each Approach the Right Choice?
Use DATEDIF with "Y" whenever the output is a person's age as a human would state it. Eligibility checks, age bands, consent thresholds, retirement dates, insurance tiers and anything that flips on a birthday all want completed years, and this is the function that counts completed years.
Use YEARFRAC with basis 1 when you need a decimal age for a calculation rather than a label, for instance when age is an input to a model, a rate or an interpolation. The fractional part carries real information there, and truncating it to whole years throws that information away.
Use a plain year subtraction when the question genuinely is about year cohorts rather than ages. School intake years, model years and "born in the 1980s" style grouping are all year-bucket questions, and =YEAR(TODAY())-YEAR(B2) answers them directly and transparently.
Use the division shortcut for exploratory work, quick averages across a large list, or any figure that is clearly presented as approximate. It reads at a glance, which is a real advantage when you are the only person who will ever see the sheet.
And calculate age outside Excel entirely when the same age has to appear in several places. A single age column in the source system, a database or a Power Query step beats four slightly different age formulas in four workbooks, because the version that disagrees with the other three will not announce itself.
The general rule across all five: pick the method that fails loudly rather than the one that fails quietly. A #NUM! error is an inconvenience. An age that is wrong on nine rows out of four hundred is a problem you may never find.
What Are the Limitations and Edge Cases?
Start with the one almost nobody plans for. Microsoft states it directly: "Microsoft Excel incorrectly assumes that the year 1900 is a leap year." The reason is the same compatibility story as DATEDIF itself. Microsoft's own account is that "When Lotus 1-2-3 was first released, the program assumed that the year 1900 was a leap year, even though it actually was not a leap year," and that "When Microsoft Multiplan and Microsoft Excel were released, they also assumed that 1900 was a leap year."
That bug is still in Excel today and will not be removed, because fixing it would shift nearly every existing date by a day. Microsoft is explicit about the consequence it considers significant: "The WEEKDAY function returns incorrect values for dates before March 1, 1900." It is equally explicit that the problem is confined to that one year, noting that Excel "correctly handles all other leap years, including century years that are not leap years (for example, 2100)."
What Microsoft's page on this does not do, anywhere, is name February 29, 1900 or mention the serial number that phantom date occupies. The framing you will find elsewhere about a specific bogus serial number is not Microsoft's wording, and the first-party account stops at the WEEKDAY consequence.
The second limitation is the floor on dates. In the 1900 date system that Excel for Windows uses by default, the earliest date Excel will represent is January 1, 1900, with a serial value of 1, running to December 31, 9999. Anyone born before 1900 cannot be aged with date arithmetic in that system at all, which turns up more often than you would think in genealogy, archives and historical records.
The third is a platform difference that catches shared files. Microsoft documents that "The default date system for Excel for Windows is 1900; and the default date system for Excel for Mac is 1904," and that the 1904 system starts from a different epoch. A workbook carries its own date-system setting, so the risk is not daily use but copying raw serial numbers between files built under different systems.
The fourth is TODAY() itself. Microsoft describes it simply as returning "the serial number of the current date," and its support page never uses the word volatile. Microsoft's developer documentation does, defining a volatile function as "one whose value cannot be assumed to be the same from one moment to the next even if none of its arguments (if it takes any) has changed," and listing TODAY among them. The practical effect: every age in the file can change without anyone editing it, and if automatic calculation is switched off, they can also fail to change when you expect them to.
The fifth is argument order. Pass a birth date as the end date rather than the start date and DATEDIF returns a #NUM! error rather than a negative number. That is arguably the right design, but it means a mis-mapped column produces a wall of errors rather than a wall of negative ages, and the fix is to swap the arguments and not to wrap the thing in ABS().
The sixth is coverage. Microsoft's supported-versions list for DATEDIF includes Excel for the web, so browser users are fine. It lists no mobile Excel version at all, neither to confirm nor to deny. If your workbook has to produce ages on a phone or tablet, that is undocumented territory and worth testing on the device rather than assuming.
Errors that hide in plain sight are the expensive kind, online as much as in a workbook. Book a free audit and we'll map what your site is quietly getting wrong.
How Does Excel Compare to the Alternatives?
Against Power BI, Excel is the simpler tool for this specific job, and that is not the usual direction of that comparison. Excel has DATEDIF, a single function that returns completed years. Power BI's DAX language has no DATEDIF; it has DATEDIFF, which counts boundaries crossed rather than completed spans, and getting a correct age out of DAX takes a deliberately awkward integer-arithmetic pattern instead. We walked through that in detail in our guide to calculating age in Power BI DAX, and the short version is that the function whose name matches the question is not the one that answers it.
Against Google Sheets, the two are close enough that formulas port directly. Sheets implements DATEDIF with the same arguments, so =DATEDIF(B2,TODAY(),"Y") works in both. The difference is formatting rather than logic: a DATEDIF result in Sheets is particularly prone to rendering as a date rather than a number, so set the number format explicitly after you fill the column down.
Against calculating age in the source system, Excel loses on principle and often wins on practice. A database or an application that stores a birth date can derive age at query time with proper calendar handling and no date-system quirks. But you only get that if you control the source, and most people doing this work are handed a file and asked for ages by lunchtime.
Against Power Query, which ships inside Excel, the trade is refresh behavior for transparency. A Power Query step computes age once per refresh and bakes it into the loaded table, which makes the number stable and auditable and means it does not drift between openings. A worksheet formula recalculates constantly, which is what you want on a dashboard and not what you want in a signed-off report.
Against doing it by hand, which is still how a surprising number of small lists get aged, every formula above wins. The hand method is not slow so much as inconsistent: two people working the same list will disagree on the handful of rows whose birthdays fall near today's date, and neither will be able to explain why.
Choosing the right tool for the job is half the work. Get a free audit and we'll show you which of your channels is actually worth the effort.
Final Thoughts
The formula you came for is =DATEDIF(B2,TODAY(),"Y"), and it is the right default. It counts completed years, Microsoft documents it as useful for exactly this, and it flips on the birthday rather than near it.
What is worth carrying away beyond the formula is how much of the confusion around this topic comes from Microsoft's own documentation disagreeing with itself. One page says DATEDIF is useful for age. Another page calculates age four different ways without mentioning it. A third warns that the function may calculate incorrect results and recommends against one of its six units. All three are current, and all three are first-party.
The way through that is to treat each method as having a job rather than a ranking. Completed years for labels and thresholds, YEARFRAC with basis 1 for decimals that feed a calculation, year subtraction for cohorts, and division for approximations that are clearly labeled as approximate.
Then check the edges that the formulas cannot check for you: blank birth dates reading as 1900, anyone born before the date system starts, a column formatted as a date when it should be a number, and a TODAY() that will quietly change every age in the file tomorrow morning.
Want this done for you?
SEO Stuff gets businesses cited by ChatGPT, Gemini, Perplexity and Claude, and ranking in Google. Start with the free audit, a call, or the package.
See where you stand
A free, manual SEO + AI search audit of your site, with a report within 48 hours. No credit card, no sales call.
Get my free auditTalk it through
A free 15-minute call with the founder about whether AI search is a meaningful opportunity for your business.
Free strategy callHave it done
The Done-For-You Package: audit, 10 pages of content, 3 DR50+ placements, dashboard. $999 once, delivered in 21 business days.
See the package

