How to Calculate Age in Excel
In this article
You can calculate a person’s exact age in Excel using the DATEDIF function or the YEARFRAC function combined with INT. Both methods give you the difference in years, months, and days, which is essential for HR tracking, customer databases, or personal record-keeping. First, ensure your dates are stored in Excel’s native date format (e.g., 01/01/1990 or Jan 1, 1990) so the formulas can read them correctly.
What You'll Need
- A computer with Microsoft Excel installed (Excel 2013 or newer is recommended for full feature support).
- A spreadsheet containing at least two columns: one for the birth date and one for the current date, or a single column if you are calculating age as of today.
- Familiarity with basic spreadsheet navigation (clicking into cells, typing formulas, and copying them down a column).
Step-by-Step
- Prepare your data. Open a blank Excel sheet. In the first column (Column A), type the word BirthDate in cell A1. Below it, enter the dates of birth in cells A2 through A10. Ensure these are entered as dates (e.g., 05/15/1985). In the second column (Column B), type CurrentDate in cell B1. In cell B2, enter the date you want to calculate ages against. If you want all ages to be calculated as of today, you can use the formula
=TODAY()in this cell. If you want to compare against a specific past or future date, type that date manually. - Calculate the exact age in years, months, and days using DATEDIF. Click on cell C2. This is where the result will appear. Type the following formula exactly as shown, ensuring spaces are used for readability (they do not affect the formula):
=DATEDIF(A2, B2, "Y") & " Years, " & DATEDIF(A2, B2, "YM") & " Months, " & DATEDIF(A2, B2, "MD") & " Days"
Press Enter. You will see the result, such as 38 Years, 2 Months, 14 Days. This formula breaks the calculation into three parts. The first part calculates full years, the second calculates the remaining months after those full years, and the third calculates the remaining days after those remaining months. - Copy the formula down the column. Click on cell C2. You will see a small square handle in the bottom-right corner of the cell. Click and drag this handle down to cell C10 to copy the formula to all your records. Excel will automatically adjust the cell references (A2 becomes A3, etc.) for each row.
- Format the result (optional). If you prefer a cleaner look, you can format the cells in Column C to display only the total number of years. Click on the header of Column C to select the entire column. Right-click and select Format Cells. Go to the Number tab, choose Number from the list on the left, and set the decimal places to 0. Click OK.
- Calculate age in decimal years using YEARFRAC and INT. This method is useful if you need a single number representing age for sorting or quick math, rather than a string of text. Click on cell D2. Type the following formula:
=INT(YEARFRAC(A2, B2))
Press Enter. This will give you the integer part of the age, for example, 38. TheYEARFRACfunction calculates the fraction of a year between two dates, and theINTfunction rounds it down to the nearest whole number. - Copy the YEARFRAC formula. Drag the handle in the bottom-right corner of cell D2 down to cell D10 to apply it to your dataset. You now have both a detailed text format in Column C and a numerical format in Column D.
Common Mistakes
One of the most frequent errors when calculating age in Excel involves the format of the source data. If the birth dates are typed as text (e.g., entered as 1990-05-15 without the slashes or without the year first), Excel will treat them as text strings. The DATEDIF function will return a #VALUE! error because it cannot perform mathematical operations on text. To fix this, select the column with the dates, go to the Data tab on the ribbon, and click Text to Columns. Choose Delimited and click Next twice, then click Finish. This often forces Excel to recognize the data as dates. Alternatively, re-enter the dates using a standard format like MM/DD/YYYY or DD/MM/YYYY.
Another common mistake is assuming that the DATEDIF function is documented in Excel’s help menu. It is actually a legacy function from Lotus 1-2-3, and while it works perfectly, Microsoft does not officially support it in their help documentation. This sometimes leads users to believe there is an error when they see a function they cannot find in the official list. It is safe to use, but if you prefer not to use it, the YEARFRAC method described in Step 5 is the official, supported alternative.
Tips
When working with dates across different regions, be mindful of the system settings. If your computer is set to a region that uses day-month-year (DD/MM/YYYY) and you enter a date like 01/05/1990, Excel might interpret it as May 1st rather than January 5th. Always check the format of the cells before applying formulas. You can do this by looking at the Number Format dropdown in the Home tab; it should say Short Date or Date.
For dynamic aging (ages that update automatically every day), use the TODAY() function for the current date. This ensures that if you open the spreadsheet next year, the ages will automatically reflect the new year without you needing to edit the dates manually.
Troubleshooting
If you see a #VALUE! error in your age column, double-check that the BirthDate and CurrentDate cells are actually formatted as dates. Click on a cell showing the error and look at the formula bar. If you see a long number (like 43892.5) or text, the formatting is wrong. Right-click the cell, select Format Cells, and choose Date. Re-enter the date if necessary.
If the result is a negative number, it means the birth date is later than the current date. This can happen if you are using a future date in the CurrentDate cell. Ensure you are comparing the dates against a point in time that has already occurred.
If the result is showing as a number with many decimal places (e.g., 38.999999), your formula is likely returning a decimal value rather than an integer. If you are using the YEARFRAC method, wrap it in the INT function as shown in Step 5, or change the cell format to Number with 0 decimal places.
Frequently Asked Questions
Does Excel automatically update age calculations?
Yes, if you use the TODAY() function for the current date. The spreadsheet will update the age calculation each time you reopen the file, reflecting the current day.
What is the difference between DATEDIF and YEARFRAC?
DATEDIF returns specific units of time (years, months, days) as a text string, which is great for reading. YEARFRAC returns the fraction of a year between two dates, which is useful for financial calculations or sorting by age in a numerical sort order.
Why does the DATEDIF function not appear in the formula autocomplete?
It is a compatibility function inherited from older spreadsheet software. Excel does not list it in the official help documentation, but it functions correctly and is widely used.
How do I calculate age in months only?
Use the DATEDIF function with the "M" unit. The formula would be =DATEDIF(A2, B2, "M").
Can I calculate age for a list of names at once?
Absolutely. Once you have entered the formula in the first cell (C2), simply double-click the small square handle in the bottom-right corner of the cell. Excel will automatically fill the formula down the entire column for all rows that have data in the adjacent columns.