Menu

Days Between Two Dates in Excel: Subtract, DAYS, DATEDIF

=B2-A2 returns the number of days between the date in A2 and the later date in B2. Count days with DAYS, include both dates, and get weeks, months, years or working days instead.

Every sheet on this page is live: change a number or a formula and it recalculates.

=B2-A2 returns the number of days between the date in A2 and the later date in B2. Excel stores every date as a whole number of days (2026-03-15 is 46096), so subtracting one date from another gives the days in between.

Days from order to delivery
C2
ABC
1OrderedDeliveredDays
22026-03-022026-03-097
32026-03-052026-03-072
42026-03-102026-04-0223
52026-03-282026-04-036
62026-12-292027-01-046
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

The orders took 7, 2, 23, 6 and 6 days. Subtraction handles month and year boundaries on its own: the last order crosses New Year and still counts 6 days. Change a delivery date and the count follows. If the earlier date is in B, the result is negative: -7 rather than 7.

The DAYS function

=DAYS(end_date, start_date) does the same subtraction, with the end date first. It gives the same numbers as =B2-A2; the main reason to prefer it is that the name says what the formula does.

Subtraction and DAYS
D2
ABCD
1StartEndB2-A2DAYS
22026-01-152026-03-105454
32026-02-012026-03-012828
42024-02-012024-03-012929
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

February 2026 has 28 days and February 2024 has 29: Excel knows the calendar, leap years included. Watch the argument order: =DAYS(A2,B2) returns -54 for the first row. DAYS needs Excel 2013 or later; subtraction works everywhere.

Count days including the start and end date

Subtraction counts the days between two dates, which is the number of nights. A booking from July 6 to July 10 is 4 nights, but a car rented from July 6 to July 10 is paid for 5 days. When both the first and last day count, add 1.

Nights and days
D2
ABCD
1FromToNightsDays (both counted)
22026-07-062026-07-1045
32026-07-312026-08-0112
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

A single day, from 2026-07-06 to 2026-07-06, is 0 by subtraction and 1 with the +1. This is where most off-by-one errors in date sheets come from, so decide which you need before filling the column.

Weeks, months and years between two dates

Divide the days by 7 for weeks. Months and years are not a fixed number of days, so use DATEDIF, which counts complete calendar months and years.

Weeks, months and years
D2
ABCDEF
1StartEndWeeksFull weeksMonthsYears
22025-06-152026-09-3067.467151
32024-01-012026-01-01104.4104242
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

From 2025-06-15 to 2026-09-30 is 67.4 weeks, 67 full weeks, 15 complete months and 1 complete year. DATEDIF needs the earlier date first and returns #NUM! the other way round.

Working days between two dates

To count only Monday to Friday, use NETWORKDAYS(start, end). It counts both the start and the end date when they are weekdays, and can skip a list of holidays as a third argument. NETWORKDAYS and WORKDAY covers holidays and other weekends.

Calendar days and working days
D2
ABCD
1StartEndCalendar daysWorking days
22026-03-022026-03-131210
32026-03-062026-03-0942
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

March 2 to March 13, 2026 is 12 days counting both ends, of which 10 are weekdays. A Friday to the following Monday is 4 days and 2 working days.

Practice: delivery time

Your turn
C2
ABC
1OrderedDeliveredDays
22026-05-182026-05-27
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

Your turn: In C2, calculate how many days the order took, from the order date in A2 to the delivery date in B2.

Why the result shows as a date or

Two display problems come up often with date subtraction:

  • The result looks like a date (1900-01-07, or 1/7/1900 with US settings). The cell kept a date format, so 7 days is shown as day 7 of Excel's calendar. Select the cells and choose Home > Number Format > General.
  • The cell fills with #####. The result is negative (the dates are the wrong way round) and the cell is formatted as a date, which cannot be negative. Swap the dates, use =ABS(B2-A2), or format the cell as General to see the negative number.

If the result is #VALUE!, one of the cells holds text that only looks like a date, such as 15.03.2026 in an Excel set to US dates. Check with =ISNUMBER(A2): a real date returns TRUE.

Frequently Asked Questions

How do I calculate the number of days between two dates in Excel?

Subtract the earlier date from the later one: =B2-A2. Excel stores dates as numbers of days, so the result is the number of days between them. =DAYS(B2,A2) gives the same result.

How do I count days including the start and end date?

Add 1: =B2-A2+1. From July 6 to July 10 is 4 days by subtraction (the nights of a hotel stay) and 5 days counting both ends (the days of a rental).

How do I calculate the months between two dates in Excel?

=DATEDIF(A2,B2,"M") counts the complete months. For years use "Y". DATEDIF needs the earlier date first.

What is the difference between DAYS and subtracting dates?

None in the result: =DAYS(B2,A2) and =B2-A2 return the same number of days. DAYS takes the end date first and needs Excel 2013 or later; subtraction works in every version.

How do I calculate the weeks between two dates in Excel?

Divide the days by 7: =(B2-A2)/7 gives weeks with a decimal part, and =INT((B2-A2)/7) the complete weeks.

Coddy programming languages illustration

Learn to code with Coddy

GET STARTED