Age in Excel
The Excel and Google Sheets formulas for exact age, days between dates and working days, with the month end warning you need to know.
Use the age calculator between two dates
Exact age with DATEDIF
Put the birth date in A1 and the end date in B1.
| What you want | Formula |
|---|---|
| Completed years | =DATEDIF(A1,B1,"Y") |
| Months since the last birthday | =DATEDIF(A1,B1,"YM") |
| Days since the last monthly anniversary | =DATEDIF(A1,B1,"MD") |
| Total days | =B1-A1 |
| Decimal age | =YEARFRAC(A1,B1,1) |
Example: A1 is 15 March 1990 and B1 is 20 November 2026. DATEDIF with "Y" gives 36, with "YM" gives 8, and with "MD" gives 5, and B1 minus A1 gives 13,399. Together they read 36 years, 8 months and 5 days. Because the "MD" result can be wrong around month ends, check it against the calculator on this site before you rely on it; the "Y" and "YM" figures and the total days do not have that problem.
Read the three DATEDIF results as one answer, not three separate ones. The "Y" result is the completed years, the "YM" result is the whole months since the last birthday, and the "MD" result is the days since the last monthly anniversary. For 15 March 1990 to 20 November 2026, the last birthday was 15 March 2026, the last monthly anniversary was 15 November 2026, and 5 days passed after that. The total of 13,399 days is the same span counted a different way.
The decimal age from YEARFRAC is a different kind of answer again. With the same two dates it gives about 36.68, which suits a chart or a calculation, but not a form: forms ask for completed years, so use the "Y" result for those.
Warning: DATEDIF "MD" at month ends
Microsoft warns that the "MD" unit, for the days part, can give wrong results around month ends. Check any result that involves the 29th, 30th or 31st against the calculator on this site before you use it on a form. The "Y" and "YM" units and the plain subtraction for total days do not have this problem.
The safest habit is to treat "MD" as a draft. If either date falls on the 29th, 30th or 31st, verify the days part on the calculator here before you copy it anywhere. A wrong days figure is easy to miss, because the years and months still look right.
Worked example: NETWORKDAYS with holidays
This example counts working days in November 2026 for a small project, first without holidays and then with two public holidays removed. Put the start date in A1 and the end date in B1, and list the holidays in C1:C2.
| Cell | Value | Note |
|---|---|---|
| A1 | 2 November 2026 | A Monday. |
| B1 | 30 November 2026 | Also a Monday. |
| C1 | 11 November 2026 | Veterans Day, a Wednesday. |
| C2 | 26 November 2026 | Thanksgiving Day, a Thursday. |
| Formula | Result | What it means |
|---|---|---|
| =NETWORKDAYS(A1,B1) | 21 | All Monday to Friday days from 2 to 30 November, counting both dates. |
| =NETWORKDAYS(A1,B1,C1:C2) | 19 | The same 21 days minus the 2 holidays listed in C1:C2. |
| =B1-A1 | 28 | All calendar days between the two dates, weekends included. |
| =B1-A1+1 | 29 | All calendar days counting both the first and the last day. |
Check the 21 by hand: November 2026 has 4 full working weeks in this span, which is 20 working days, plus Monday 30 November, which makes 21. The two holidays both fall on weekdays, so each one removes exactly one day, leaving 19.
Two details catch people out. First, NETWORKDAYS counts both the start date and the end date when they are working days, so a span of a single Monday gives 1, not 0. Second, holidays must be real dates in the cells, not text that looks like a date: text is ignored silently and the count stays too high. For a fuller working-days count with the same rules, see the working days calculator.
Days and working days
| What you want | Formula |
|---|---|
| Days between two dates | =B1-A1 |
| Days counting both dates | =B1-A1+1 |
| Working days (Monday to Friday) | =NETWORKDAYS(A1,B1) |
| Working days minus holidays | =NETWORKDAYS(A1,B1,C1:C11) |
| Date 90 days from now | =TODAY()+90 |
| Date 3 months from now | =EDATE(A1,3) |
NETWORKDAYS counts Monday to Friday and skips the dates you list in the holidays range. List the holiday dates in a column, for example C1:C11 for the 11 US federal holidays, and pass that range as the third argument, as in =NETWORKDAYS(A1,B1,C1:C11). Without that range it skips weekends only. In Google Sheets the same formulas work, with the same names.
Adding months with EDATE
EDATE moves a date by whole calendar months, keeping the day of the month when it exists and using the last day of the month when it does not. With 31 January 2026 in A1, =EDATE(A1,3) gives 30 April 2026, a Thursday, because April has no 31st. That is the same month end rule the add days to date calculator uses, and it is the safe way to add months in a spreadsheet: adding 90 days is not the same as adding 3 months, and adding 30 days is not the same as adding 1 month.
For days, plain addition is enough. =TODAY()+90 gives the date 90 days from today, and =A1+42 adds 6 weeks.
Why a result sometimes shows as a date
Excel stores every date as a serial number, counting days from 1 January 1900, and that is why subtraction works: =B1-A1 is just one serial number minus another. The same habit causes the most common confusion on this page. When you subtract two dates, Excel often copies the date format onto the answer, so 13,399 shows up as a strange date in the year 1936 instead of as a number. Select the result cell, open Format Cells, and choose Number or General. The value does not change, only the display does.
Common mistakes
- Trusting DATEDIF "MD" near a month end. The days part can be wrong when either date falls on the 29th, 30th or 31st. Verify those results against a calendar calculator.
- Expecting DATEDIF in the formula list. DATEDIF is undocumented and kept for compatibility, so Excel never suggests it and shows no help text. Type the whole formula by hand, including the quotation marks around "Y", "YM" or "MD", or the cell shows an error.
- Forgetting NETWORKDAYS counts both endpoints. A span from Monday to Friday is 5 working days, not 4. If your count is always 1 too high or 1 too low against a colleague's, one of you is counting the endpoints differently.
- Listing holidays as text. A holiday typed as text, or pasted from a web page as text, is ignored without any warning. Make sure each holiday cell holds a real date, and test it: removing the holiday from the list should change the result by exactly 1 when it falls on a weekday.
- Typing dates in the wrong order. 03/04/2026 is 3 April in most countries and March 4 in the US, and Excel follows the settings of the computer it runs on. A file built on one setting and opened on another can silently swap day and month, so write dates out as 4 Mar 2026 where it matters.
- Adding a year as 365 days. A span that crosses 29 February has 366 days. Use =EDATE(A1,12) for a year, not =A1+365, or the result lands one day early.
- Reading YEARFRAC as years, months and days. YEARFRAC gives a decimal like 36.68, which is fine for a chart but meaningless on a form. Use DATEDIF "Y" for completed years and read the months and days separately.
Frequently asked questions
What is the Excel formula for age?
With the birth date in A1 and the end date in B1, use =DATEDIF(A1,B1,"Y") for completed years, =DATEDIF(A1,B1,"YM") for the months since the last birthday, and =B1-A1 for total days.
Why is DATEDIF MD unreliable?
Microsoft warns that the MD unit can give wrong results around month ends. Check any result involving the 29th, 30th or 31st against a calendar calculator.
How do I count working days in Excel?
Use =NETWORKDAYS(A1,B1) for Monday to Friday days. Add a holidays range as the third argument to skip public holidays as well.
Why does DATEDIF not appear in the formula list?
DATEDIF is an undocumented function kept for compatibility with older spreadsheets. It works when you type it by hand, but Excel does not suggest it and gives no help text for it.
Does NETWORKDAYS count the start and end dates?
Yes, it counts both the start date and the end date when they fall on a working day. A single Monday on its own gives 1, not 0.
Why does =B1-A1 show a date instead of a number?
Excel copied the date format from the cells you subtracted. Select the result cell, open Format Cells, and choose Number or General to see the day count.