How to Calculate the Number of Days Between Two Dates in Excel

Reading time: 3 minutes

How many days between two dates? In Excel, the answer is a simple subtraction, but you need to know which days you are counting. The time it took a customer to pay an invoice and the number of days in a holiday period are two different questions, and they don’t give the same result.

Try it right now

Ten invoices, an issue date and a payment date: how long did each customer take to pay? Work it out in 6 steps, free and corrected as you type:

difference dates quiz83

Date Exercise - Calculate an invoice's payment time (in days and weeks)

Calculate the number of days between two invoice dates by subtraction, add days to a date, and count full weeks with INT — 6 guided steps.

Compute the difference between D2 and C2 in G2

1 / 6

Compute the payment period of INV-001 (D2 − C2)

Dates — Q1 · 605

Compute the difference between D5 and C5 in G2

2 / 6

Compute the payment period of INV-004 (D5 − C5)

Dates — Q2 · 606

Compute the difference between D10 and C10 in G2

3 / 6

Compute the payment period of INV-009 (D10 − C10)

Dates — Q3 · 607

Compute the difference between C6 and C2 in G2

4 / 6

Number of days between the issue of INV-001 and INV-005 (C6 − C2)

Dates — Q4 · 608

Add 7 days to C2 in G2

5 / 6

Add 7 days to the issue date of INV-001 (C2)

Dates — Q5 · 609

Divide the difference D4−C2 by 7 and round down with INT — G2

6 / 6

Number of full weeks between C2 and D4 (use INT)

Dates — Q6 · 610

Your score is

0%

Subtract the two dates

Excel stores every date as a number: 1 for 1 January 1900, then one more for each day. So the difference between two dates is just one date minus the other.

=B2-B1

Between 23 October and 15 November 2023, the result is 23. That is the number of days that have passed: a payment time, a delivery delay, the nights spent in a hotel. This is what the exercise above uses.

💡 If the result shows as a date instead of a number, change the cell format to General.

Wrong formula to calculate the number of days between 2 dates

Add 1 when both days count

Now count the days on a calendar from 23 October to 15 November: there are 24, not 23. The subtraction leaves out the first day. When both the first and the last day are part of the period (days of holiday, days worked on a project, days of a training course), add 1:

=B2-B1+1

Correct formula to calculate the number of days between 2 dates

To count full weeks, divide by 7 and keep the whole part with INT: =INT((B2-B1)/7) returns 3.

Count only the working days

To leave out Saturdays and Sundays, use NETWORKDAYS. The first argument is the start date, the second the end date:

=NETWORKDAYS(B1,B2)

The result is 18. NETWORKDAYS already counts the first and the last day, so there is no need to add 1.

NETWORDAYS function to count the number of working days between 2 dates

Remove the public holidays too

Type the holidays in a range of cells, then select that range as the third argument:

=NETWORKDAYS(B1,B2,A8:A11)

With 4 holidays falling on weekdays, the result drops to 14. A holiday that falls on a weekend changes nothing, because that day was already excluded.

Exclude also the holidays by addind them in the NETWORKDAYS function

If your weekend is not Saturday and Sunday, use NETWORKDAYS.INTL. Its third argument sets the weekend: for example, 7 for Friday and Saturday.

=NETWORKDAYS.INTL(B1,B2,7)

Practice with exercises

Related articles

Practice this function

Reading is a good start, but practice is how you remember. These exercises are based on real questions from Excel forums, with instant correction.

Leave a Reply

Your email address will not be published. Required fields are marked *

How to Calculate the Number of Days Between Two Dates in Excel

Reading time: 3 minutes

How many days between two dates? In Excel, the answer is a simple subtraction, but you need to know which days you are counting. The time it took a customer to pay an invoice and the number of days in a holiday period are two different questions, and they don’t give the same result.

Try it right now

Ten invoices, an issue date and a payment date: how long did each customer take to pay? Work it out in 6 steps, free and corrected as you type:

difference dates quiz83

Date Exercise - Calculate an invoice's payment time (in days and weeks)

Calculate the number of days between two invoice dates by subtraction, add days to a date, and count full weeks with INT — 6 guided steps.

Compute the difference between D2 and C2 in G2

1 / 6

Compute the payment period of INV-001 (D2 − C2)

Dates — Q1 · 605

Compute the difference between D5 and C5 in G2

2 / 6

Compute the payment period of INV-004 (D5 − C5)

Dates — Q2 · 606

Compute the difference between D10 and C10 in G2

3 / 6

Compute the payment period of INV-009 (D10 − C10)

Dates — Q3 · 607

Compute the difference between C6 and C2 in G2

4 / 6

Number of days between the issue of INV-001 and INV-005 (C6 − C2)

Dates — Q4 · 608

Add 7 days to C2 in G2

5 / 6

Add 7 days to the issue date of INV-001 (C2)

Dates — Q5 · 609

Divide the difference D4−C2 by 7 and round down with INT — G2

6 / 6

Number of full weeks between C2 and D4 (use INT)

Dates — Q6 · 610

Your score is

0%

Subtract the two dates

Excel stores every date as a number: 1 for 1 January 1900, then one more for each day. So the difference between two dates is just one date minus the other.

=B2-B1

Between 23 October and 15 November 2023, the result is 23. That is the number of days that have passed: a payment time, a delivery delay, the nights spent in a hotel. This is what the exercise above uses.

💡 If the result shows as a date instead of a number, change the cell format to General.

Wrong formula to calculate the number of days between 2 dates

Add 1 when both days count

Now count the days on a calendar from 23 October to 15 November: there are 24, not 23. The subtraction leaves out the first day. When both the first and the last day are part of the period (days of holiday, days worked on a project, days of a training course), add 1:

=B2-B1+1

Correct formula to calculate the number of days between 2 dates

To count full weeks, divide by 7 and keep the whole part with INT: =INT((B2-B1)/7) returns 3.

Count only the working days

To leave out Saturdays and Sundays, use NETWORKDAYS. The first argument is the start date, the second the end date:

=NETWORKDAYS(B1,B2)

The result is 18. NETWORKDAYS already counts the first and the last day, so there is no need to add 1.

NETWORDAYS function to count the number of working days between 2 dates

Remove the public holidays too

Type the holidays in a range of cells, then select that range as the third argument:

=NETWORKDAYS(B1,B2,A8:A11)

With 4 holidays falling on weekdays, the result drops to 14. A holiday that falls on a weekend changes nothing, because that day was already excluded.

Exclude also the holidays by addind them in the NETWORKDAYS function

If your weekend is not Saturday and Sunday, use NETWORKDAYS.INTL. Its third argument sets the weekend: for example, 7 for Friday and Saturday.

=NETWORKDAYS.INTL(B1,B2,7)

Practice with exercises

Related articles

Practice this function

Reading is a good start, but practice is how you remember. These exercises are based on real questions from Excel forums, with instant correction.

Leave a Reply

Your email address will not be published. Required fields are marked *