How to calculate days between dates in Excel
To calculate the days between two dates in Excel, subtract the earlier date from the later one: =B2-A2. Excel stores dates as numbers, so the result is a number of days. This guide shows that, how to count only working days, how to get an age in years or months, and how to fix a result that shows up as a date.
1. Subtract the dates
A date in Excel is a serial number that counts the days since 1 January 1900, so dates behave like numbers. Subtract the start from the end. If the result shows as a date such as 30-Jan-1900, select the cell and set the format to General or Number.
Example: Days in March
| A | B | C | |
|---|---|---|---|
| 1 | Start | End | Days |
| 2 | 2026-03-01 | 2026-03-31 | 30 |
The result is 30, because the start day is not counted. Add 1 if you want both ends included.
2. Count working days only
NETWORKDAYS counts the days between two dates and skips Saturdays and Sundays. Add a range of holiday dates as a third argument to skip those too. Both the start and the end day are included in the count.
Example: Working days in March 2026
| A | B | C | |
|---|---|---|---|
| 1 | Start | End | Working days |
| 2 | 2026-03-01 | 2026-03-31 | 22 |
March 2026 starts on a Sunday and has 22 weekdays.
3. Calculate an age in years
DATEDIF returns the whole years, months or days between two dates. The third argument sets the unit: "y" for years, "m" for months and "d" for days. For an age, use the birth date as the start and TODAY as the end, so the age updates by itself.
Example: Age in whole years
| A | B | C | |
|---|---|---|---|
| 1 | Born | On | Age |
| 2 | 1990-06-15 | 2026-11-15 | 36 |
From 15 June 1990 to 15 November 2026 is 36 full years. The 37th birthday comes in June.
4. Months and years together
To write an age as years and months, combine two DATEDIF results: the whole years with "y", and the months left over with "ym". Join them with the ampersand, as in =DATEDIF(A2,B2,"y")&" years, "&DATEDIF(A2,B2,"ym")&" months". The start date must be earlier than the end date, or DATEDIF returns #NUM!.
Common mistakes
Dates stored as text. A date typed in a format Excel does not recognize stays left-aligned, and subtraction gives #VALUE!.
Fix: Re-enter the date, or use DATE(year, month, day) to build a real date.
Reading the result as a date. The result cell inherits a date format and shows a strange date.
Fix: Set the result cell to the General or Number format.
Swapping the start and the end. DATEDIF returns #NUM! and a subtraction returns a negative number.
Fix: Put the earlier date first.
Frequently asked questions
Does the subtraction count both the start and the end day?
No. It counts the days between them, so the start day is not included. NETWORKDAYS does include both ends.
Why does DATEDIF not appear in the function list?
Excel keeps it for compatibility and does not suggest it as you type, but it works in every version.
How do I add days to a date?
Add the number: =A2+30 is 30 days later. For months, use EDATE; for the end of a month, use EOMONTH.
Related functions
- NETWORKDAYSNETWORKDAYS counts the working days between two dates, Monday to Friday, optionally skipping holidays.
- TODAYTODAY returns the current date and NOW adds the time.
- DATEDATE builds a real Excel date from a year, month and day.
- EOMONTHEOMONTH returns the last day of a month; EDATE the same day a number of months later or earlier.
- MONTHMONTH, YEAR and DAY return one part of a date as a number.
More on date differences
The guide covers subtraction, NETWORKDAYS and DATEDIF. This piece adds how to include holidays, how to calculate an age that updates itself, and how to show a difference as years, months and days.
Working days with holidays
List the holidays in a column, one date per cell, and give that range as the third argument. Both the start day and the end day count, and any holiday that falls on a weekend is ignored. If your week is not Monday to Friday, use NETWORKDAYS.INTL, which takes a weekend code.
=NETWORKDAYS(A2,B2,$F$2:$F$10)An age that updates itself
Replace the end date with TODAY and the age is always current. The same works for how long a customer has been with you or how many days remain until a deadline. The sheet recalculates when you open the file, so you never have to edit it. If you need the file to show a fixed date, for example in a report you send out, type the date in a cell instead and refer to that cell. A report that quietly changes every day is a common source of confusion.
=DATEDIF(A2,TODAY(),"y")Years, months and days together
DATEDIF has three units that ignore the larger part: "ym" gives the months left after whole years, "md" gives the days left after whole months, and "yd" gives the days left after whole years. Join them with the ampersand to make a sentence. Test the result with a date you know, because "md" can give odd results around the end of a month.
More on dates is in [the dates lesson](/learn/dates) and [the date functions page for EOMONTH](/functions/eomonth).