How to Calculate Age in Excel: Step-by-Step Guide
In this article
To calculate age in Excel, subtract the birth date from today's date and divide by 365.25, or use the DATEDIF function for a whole-number age. For example, if the birth date is in cell A2, enter =DATEDIF(A2, TODAY(), "Y") to get the age in completed years. This guide walks you through the exact formulas, how to handle common issues, and tips for accurate results.
What You'll Need
- Microsoft Excel (any recent version) or a compatible spreadsheet app like Google Sheets or LibreOffice Calc.
- Dates of birth stored as actual Excel dates (not text).
- A basic understanding of cell references (e.g., A2, B2).
Step-by-Step
- Enter the birth dates. In column A, type each birth date in a format Excel recognises, such as
MM/DD/YYYY(US) orDD/MM/YYYY(UK). Ensure the cells are formatted as dates: select the cells, right-click, choose Format Cells, and pick Date. If Excel treats them as text (left-aligned), use Data > Text to Columns or re-enter them. - Choose a cell for the age. For example, click cell B2 next to the first birth date.
- Enter the DATEDIF formula. Type
=DATEDIF(A2, TODAY(), "Y")and press Enter. This returns the number of complete years between the birth date and today. The result updates automatically each time the workbook recalculates. - Copy the formula down. Drag the fill handle (small square at the bottom-right of cell B2) down to apply the formula to other rows. Excel adjusts the cell references automatically.
- For a more precise age including months and days, use a nested formula:
=DATEDIF(A2,TODAY(),"Y") & " years, " & DATEDIF(A2,TODAY(),"YM") & " months, " & DATEDIF(A2,TODAY(),"MD") & " days". This gives a readable result like "35 years, 2 months, 10 days". - Alternative: use YEARFRAC. If you need a decimal age (e.g., 35.25), enter
=YEARFRAC(A2, TODAY()). This returns the fraction of a year between the two dates. Multiply by 1 for years, or use it directly in further calculations. - Format the result. If you used DATEDIF, the result is a number. You can leave it as is or combine it with text as shown in step 5. For YEARFRAC, you may want to format the cell to show two decimal places: right-click the cell, choose Format Cells, Number, and set Decimal places to 2.
- Handle blank cells. If some birth dates are missing, wrap the formula in IFERROR or IF to avoid errors:
=IF(A2="","",DATEDIF(A2,TODAY(),"Y")). This leaves the age blank when no date is entered.
Common Mistakes
- Dates stored as text. If birth dates are left-aligned or don't calculate, they may be text. Convert them using Date > Text to Columns or re-enter in a recognised date format.
- Using TODAY() without parentheses. TODAY is a function and requires empty parentheses:
TODAY(). TypingTODAYalone may cause a #NAME? error. - Forgetting to lock cell references. When copying formulas, relative references adjust automatically. If you need a fixed reference (e.g., a specific date), use absolute references like
$A$2. - Assuming DATEDIF is in the function list. DATEDIF is a hidden function in Excel; it won't appear in the autocomplete list, but it works if typed correctly. In some versions, you may need to type it manually.
- Using 365 instead of 365.25. Dividing by 365 ignores leap years and can be off by a day or more. Use 365.25 for a more accurate decimal age, or stick with DATEDIF for whole years.
- Not accounting for future dates. If a birth date is in the future, DATEDIF returns a #NUM! error. Use IF to check:
=IF(A2>TODAY(),"Invalid",DATEDIF(A2,TODAY(),"Y")).
Tips
- Use a named range for today's date if you want to calculate age as of a specific date (e.g., a competition cutoff). Enter the date in a cell, name it (Formulas > Define Name), and reference it instead of TODAY().
- For sorting or filtering, keep the age as a number (not text). Use DATEDIF with "Y" for whole years, or YEARFRAC for decimals.
- To calculate age at a specific date (e.g., event date), replace TODAY() with that date or a cell reference.
- Use conditional formatting to highlight ages over a certain threshold, e.g., for age verification.
- In Google Sheets, DATEDIF works the same way. YEARFRAC is also available.
- For large datasets, convert your range to an Excel Table (Insert > Table) so formulas auto-fill for new rows.
Troubleshooting
- #NUM! error: The start date is after the end date. Check that the birth date is earlier than TODAY() or your reference date.
- #VALUE! error: One of the arguments is not a valid date. Ensure the birth date cell contains a date, not text.
- Formula returns 0 or wrong age: Verify the date format. If dates are in DD/MM/YYYY but Excel expects MM/DD/YYYY, it may misinterpret. Use Date > Text to Columns to set the correct format.
- DATEDIF not working: Ensure you're using the correct syntax:
DATEDIF(start_date, end_date, unit). Units are "Y", "M", "D", etc., in quotes. - Results don't update: Press F9 to recalculate, or check that automatic calculation is on (Formulas > Calculation Options > Automatic).
- If you see a circular reference warning, check that the formula isn't referencing its own cell.
Frequently Asked Questions
Can I calculate age in years and months without DATEDIF?
Yes, you can use =INT((TODAY()-A2)/365.25) for years, but it's less accurate for months. DATEDIF is the most reliable method for combined years, months, and days.
Why does DATEDIF not appear in Excel's function list?
DATEDIF is a hidden function kept for compatibility with Lotus 1-2-3. It works if typed manually but won't show in autocomplete. Microsoft recommends it for age calculations despite being undocumented.
How do I calculate age on a specific date, not today?
Replace TODAY() with that date or a cell reference. For example, =DATEDIF(A2, "2025-12-31", "Y") gives age as of 31 Dec 2025. Ensure the date is in a recognised format or use DATE(2025,12,31).
What's the difference between DATEDIF and YEARFRAC?
DATEDIF returns whole units (e.g., completed years), while YEARFRAC returns a decimal fraction of a year. Use DATEDIF for age in years, YEARFRAC for precise decimal ages.
Can I use these formulas in Google Sheets?
Yes, DATEDIF and YEARFRAC work in Google Sheets with the same syntax. TODAY() also works identically.
How do I handle leap years in age calculation?
DATEDIF automatically accounts for leap years because it counts actual days between dates. YEARFRAC also handles leap years correctly. Avoid dividing by 365 if you need precision.