Count days between dates in Excel tutorial thumbnail

Get the Working Days Practice Workbook

Practice with the same dates as the tutorial: NETWORKDAYS.INTL with weekends, holiday ranges and custom work patterns, all set up and ready to edit.

How to Calculate Days Between Two Dates (Simple Subtraction)

As usual, we begin with a set of data: a start date, and an end date.

Start date 6/2/2021 and end date 6/14/2021 in Excel columns A and B

The simplest way to count the days between two dates is to subtract the start date from the end date.

=B2-A2
Formula =B2-A2 returns 12 days between two dates in Excel

Because Excel stores dates as whole numbers, it’s very easy to calculate the difference between two dates.

If we add a second set of dates and fill the formula down, we can calculate a different number of days.

Second date range from 6/24/2021 to 6/30/2021 returns 6 days

Why Date Subtraction Does Not Count the First Day

On the calendar, the first range (blue) covers 13 days and the second range (tan) covers 7. The formula returns 12 and 6.

June 2021 calendar with the two date ranges shaded in blue and tan

Subtraction counts the end date but not the start date, so each result is one day short of what you see on the calendar.

If you need to include the first day in the result, you can always modify the formula to add 1 to the result.

=B2-A2+1

Need totals between two dates instead of a count? See how to sum values between two dates with SUMIFS.

How to Count Working Days Excluding Weekends and Holidays (NETWORKDAYS.INTL)

Now let’s count only the working days, without weekends and holidays.

When it comes to letting Excel know your specific holidays (technically, these can be ANY days you wish to skip, not just sanctioned holidays), you need to create a list of the unwanted days somewhere in your workbook.

Below we have created in cells D7 through D9 a shortlist of days we will ignore during the calculations.

Holiday list in Excel cells D7 to D9 with June 3, 28 and 29, 2021

NETWORKDAYS vs NETWORKDAYS.INTL: What Is the Difference?

The NETWORKDAYS function returns the number of whole working days between a start_date and end_date.  Working days exclude weekends and any dates identified in holidays.

NETWORKDAYS.INTL, added in Excel 2010, has an extra argument that lets you choose your weekend days. The original NETWORKDAYS always treats Saturday and Sunday as the weekend.

The syntax for the NETWORKDAYS.INTL function is as follows:

NETWORKDAYS.INTL(start_date, end_date, [weekend], [holidays])

The NETWORKDAYS.INTL function syntax has the following arguments:

  • start_date and end_date: required. The two dates to count between. If start_date is later than end_date, the result is negative.
  • [weekend]: optional. A weekend number or a 7-character string that sets which days don’t count. Leave it out and Saturday and Sunday are the weekend.
  • [holidays]: optional. A range of dates to skip, like public holidays or vacation days. The order of the dates doesn’t matter.

For the [weekend] argument, below is a table of codes that define the various weekend combinations.

NETWORKDAYS.INTL Weekend Codes: Quick Reference Table

Use one of these numbers in the [weekend] argument, or provide a 7-character binary string for a fully custom pattern:

Weekend NumberWeekend Days
1 or omittedSaturday, Sunday
2Sunday, Monday
3Monday, Tuesday
4Tuesday, Wednesday
5Wednesday, Thursday
6Thursday, Friday
7Friday, Saturday
11Sunday only
12Monday only
13Tuesday only
14Wednesday only
15Thursday only
16Friday only
17Saturday only

How to Count Working Days with Default Saturday/Sunday Weekends

Let’s count the working days between June 2 and June 14. With Saturday and Sunday as the weekend, you only need the two dates:

=NETWORKDAYS.INTL(A2, B2)
NETWORKDAYS.INTL(A2, B2) returns 9 working days in Excel

The result is 9. Saturday and Sunday are the default, so you don’t need the third argument.

NOTE:  When using the functions to determine the number of days, the first day and last day (i.e., the [start_date] and [end_date]) are counted in the result.

June 2021 calendar showing the 9 working days between June 2 and June 14

How to Exclude Holidays from the Working Day Count

Now let’s calculate the number of days between June 2nd and June 14th excluding the weekends (5th, 6th, 12th, & 13th), as well as the holiday dates listed in cell range D7 through D9.

As we enter the same formula from above when we reach the third argument [weekends] we are presented with a list of the two-day and single weekend combinations.

NETWORKDAYS.INTL weekend argument drop-down with weekend code options

We’ll keep the Saturday and Sunday weekend and enter 1.

For the fourth argument [holidays], we select the cell range D7:D9 and lock it as an absolute reference so it doesn’t change when we repeat the formula for other examples.

=NETWORKDAYS.INTL(A2, B2, 1, $D$7:$D$9)
NETWORKDAYS.INTL with holiday range D7:D9 returns 8 working days

The result drops from 9 to 8, because June 3 is a holiday. Fill the formula down, and the second range returns 3, because June 28 and 29 are holidays too.

Second date range returns 3 working days after excluding the June 28 and 29 holidays

How to Define Any Custom Weekend Pattern with a 7-Character String

The ability to select from any single or two-day consecutive weekend is built directly into the NETWORKDAYS.INTL function.

But what if your schedule doesn’t fit a standard weekend? Say you only work Monday, Tuesday and Saturday.

None of the weekend codes covers that pattern.

The good news is that you can create any combination of days on/off you need with a really slick trick.

Here’s the trick: instead of a weekend number, use a string of seven 1s and 0s in quotes. Each character is one day, starting with Monday. 0 is a working day and 1 is a day off.

=NETWORKDAYS.INTL(A2, B2, "0011101")

If it helps, think of the zeroes as “eyes open” and the ones as “eyes closed”. The formulas will only include days it can “see” when its eyes are open.

For Monday, Tuesday and Saturday, the string is 0011101: Monday and Tuesday work, Wednesday to Friday off, Saturday work, Sunday off. The first range returns 5.

NETWORKDAYS.INTL with weekend string 0011101 returns 5 working days for Monday, Tuesday and Saturday

Fill it down and the second range returns 3: June 26, 28 and 29.

Custom weekend string returns 3 working days for the second date range

To skip holidays as well, add the holiday range as the fourth argument: =NETWORKDAYS.INTL(A2, B2, "0011101", $D$7:$D$9). The first range stays at 5, because June 3 is a Thursday and already a day off. The second range drops to 1, because June 28 and 29 are holidays.

Only 1s and 0s are allowed in the string. A string of seven 1s means there are no working days, so the result is always 0.

How to Build a Dynamic Calendar with the SEQUENCE Function

The calendar next to the data isn’t typed in. One formula in G4 spills into G4:M9.

Change the month and the dates update on their own.

Dynamic calendar in Excel updating when the month changes

It uses SEQUENCE, a dynamic array function available in Microsoft 365, Excel 2021 and later, and Excel for the web.

Here’s the formula in G4. H2 holds the first day of the month:

=IF(MONTH(SEQUENCE(6, 7, H2 - WEEKDAY(H2, 3), 1) ) = MONTH(H2), DAY(SEQUENCE(6, 7, H2 - WEEKDAY(H2, 3), 1) ), "")

Here it is with line breaks, so it’s easier to read:

SEQUENCE calendar formula split over several lines for readability

For a full yearly calendar built the same way, see how to create a calendar in Excel with one formula.

How to Calculate a Future Date from Working Days (WORKDAY.INTL)

NETWORKDAYS.INTL counts working days between two dates. Its companion, WORKDAY.INTL, does the reverse: given a start date and a number of working days, it returns the end date.

=WORKDAY.INTL(start_date, days, [weekend], [holidays])

Example: A project starts on June 2 and requires 10 working days. What is the completion date?

=WORKDAY.INTL(A2, 10, 1, $D$7:$D$9)

This returns June 17, 2021: 10 working days after June 2, skipping weekends and the June 3 holiday. If you see a number like 44364, format the cell as a date.

WORKDAY.INTL is also handy for project end dates, for example in a Gantt chart that tracks plan vs actual.

The [weekend] argument uses the same codes and 7-character strings as NETWORKDAYS.INTL. If you defined a custom weekend pattern for NETWORKDAYS.INTL, use the same pattern in WORKDAY.INTL for consistency.

To find a past date, use a negative number of days. =WORKDAY.INTL(A2, -10, 1) returns May 19, 2021, 10 working days before June 2.


Want to build real-world financial models with date calculations, budgets, and forecasts? Check out the Financial Analysis course.

Featured Course

Fundamentals of Financial Analysis

Read financial statements properly and learn the Excel formulas behind financial reporting. For people moving into finance, and for people who want to be sure nothing is missing.
Learn More
Financial Analysis Course Cover

Download the Working Days Practice Workbook

Get the Free Practice Workbook

Weekends, holidays and custom work patterns. Ready to practice.

Frequently Asked Questions

What is the difference between NETWORKDAYS and NETWORKDAYS.INTL?

NETWORKDAYS always treats Saturday and Sunday as the weekend. NETWORKDAYS.INTL adds a weekend argument, so you can pick another weekend with a number code or set any pattern with a 7-character string of 1s and 0s. It has been available since Excel 2010.

Does NETWORKDAYS count the start date and end date?

Yes. Both dates count if they are working days. Simple subtraction such as =B2-A2 does not count the start date. To leave the start date out of a NETWORKDAYS.INTL result, subtract 1.

How do I count working days with a Friday and Saturday weekend?

Use weekend code 7: =NETWORKDAYS.INTL(A2, B2, 7). For a Sunday only weekend, use 11. Add your holiday range as the fourth argument if you need it.

How do I count only certain days, like Monday, Tuesday and Saturday?

Use a 7-character string that starts with Monday, where 0 is a working day and 1 is a day off: =NETWORKDAYS.INTL(A2, B2, "0011101"). Only 1s and 0s are allowed.

What if a holiday falls on a weekend?

Nothing changes. The day is already a day off, so NETWORKDAYS and NETWORKDAYS.INTL do not subtract it a second time.

How do I find the date that is 10 working days after a start date?

Use WORKDAY.INTL: =WORKDAY.INTL(A2, 10, 1, $D$7:$D$9). It skips weekends and the holidays in D7:D9. If the result shows a number like 44364, format the cell as a date.

Leila Gharani

Founder of XelPlus and ten-time Microsoft MVP. Leila helps over 500,000 professionals master Excel, Power BI, and data automation through practical, real-world training.