Skip to content

How to calculate days between two dates in Excel in Excel

Find the number of days between two dates with simple subtraction, DAYS or DATEDIF, and count days overdue without negative results.

A task has a start date and an end date, and you need the number of days between them. Or an invoice has a due date and you need the days it is overdue.

Excel stores dates as serial numbers: one day is one whole number. That makes the answer plain subtraction: =C2-B2. Put the later date first.

DAYS does the same with the arguments in the opposite order, which is easy to mix up: =DAYS(C2, B2) is end date first, then start date. DATEDIF with the unit "D" also works, but it returns an error if the start is after the end, whereas subtraction just gives a negative number.

A date subtraction can show up as a date. When you subtract two dates, Excel sometimes copies a date format onto the answer. If you see something like 14-Jan-1900, select the cell and change the number format to General or Number on the Home tab.

The subtraction counts the days between, excluding the start date. To count both the first and last day, add 1. Whether to add it depends on the question: "how long did the task take" often means the difference, "how many days is the booking" often includes both ends.

For overdue days, you usually want a floor of zero so unpaid items that are not yet due do not show negative days: =MAX(0, as_of - due). To skip weekends, use NETWORKDAYS instead; the next how-to covers it. The Dates and finance track goes further.

3 ways to do it

1Subtract the dates

=C2-B2

  1. Type =C2-B2, with the later date first, and press Enter.
  2. If the result looks like a date, set the number format to General or Number on the Home tab.
  3. Add 1 if you need to count both the first and last day.

2DAYS function

=DAYS(C2,B2)

  1. Type =DAYS(C2,B2). The end date comes first and the start date second.

3Days overdue (never negative)

=MAX(0,$H$1-C2)

  1. Put the as-of date in its own cell, for example H1.
  2. Subtract the due date from it and wrap the result in MAX with 0 so items not yet due show 0.

Try it yourself

Solve it in the sheet. Every answer is checked, with hints if you need them.

Task 1 of 2

In D2, return the number of days from the start in B2 to the due date in C2, then fill down to D8.

Answer in D2, then it fills down to D8.

D2
A
B
C
D
E
F
G
H
1
Task
Start
Due
Days
Days overdue
As of
15-Mar-2025
2
Draft report
03-Feb-2025
21-Feb-2025
3
Review pack
10-Feb-2025
14-Mar-2025
4
Update forecast
17-Feb-2025
03-Mar-2025
5
Client call
03-Mar-2025
07-Mar-2025
6
Publish memo
05-Mar-2025
28-Mar-2025
7
Audit sign-off
10-Mar-2025
04-Apr-2025
8
Budget submit
12-Mar-2025
15-Mar-2025

Learn it properly, one graded sheet at a time.

Excel foundations covers this in lesson 6, AVERAGE, MIN and MAX.