Excel Formula to Subtract Dates Excluding Weekends

📅 Mar 11, 2026 📝 Sarah Miller

Manually calculating net working days between two dates in Excel often leads to frustrating errors, especially when project deadlines loom. While standard cell subtraction works for calendar days, it fails to isolate actual business hours. Utilizing the robust NETWORKDAYS function grants teams the ability to automatically exclude weekends, ensuring highly accurate project forecasting. Crucially, a key stipulation is accounting for public holidays and custom workweeks, which can be managed using the advanced NETWORKDAYS.INTL formula. Below, we break down the exact formulas and syntax required to master these time-tracking calculations.

Excel Formula to Subtract Dates Excluding Weekends

When managing projects, tracking deliverables, or analyzing employee performance, calculating the number of days between two dates is a routine task in Excel. However, standard date subtraction (e.g., =End_Date - Start_Date) counts every single calendar day, including weekends. For most business scenarios-such as measuring service level agreements (SLAs), calculating payroll, or tracking project milestones-you only want to count actual working days (Monday through Friday).

Fortunately, Microsoft Excel provides highly efficient, built-in functions designed specifically for this purpose. In this comprehensive guide, we will explore how to subtract two dates while excluding weekends, customize your weekend days, and even account for public holidays.

The Standard Solution: The NETWORKDAYS Function

The easiest and most common way to subtract two dates in Excel while excluding weekends is by using the NETWORKDAYS function. This function automatically excludes Saturdays and Sundays from its calculation.

Syntax of NETWORKDAYS

The syntax for the function is straightforward:

=NETWORKDAYS(start_date, end_date, [holidays])
  • start_date: The starting date of the period you want to measure.
  • end_date: The ending date of the period.
  • [holidays] (Optional): A range of cells or an array of dates representing days that should also be excluded from the working days calculation (such as national holidays or company shut-downs).

Understanding Inclusivity in NETWORKDAYS

One critical thing to understand about the NETWORKDAYS function is that it is inclusive of both the start and end dates. For example, if your start date is Monday, October 23, and your end date is Tuesday, October 24, standard subtraction would yield 1 day (24 minus 23). However, NETWORKDAYS will yield 2 because it counts both Monday and Tuesday as workdays.

If your project requirements demand exclusive calculation (i.e., you want Monday to Tuesday to equal 1), you can simply subtract 1 from the final formula output: =NETWORKDAYS(A2, B2) - 1.

Step-by-Step Example of NETWORKDAYS

Imagine you have the following dataset in an Excel sheet:

Row # A (Start Date) B (End Date) Expected Formula Result
2 2023-10-20 (Friday) 2023-10-27 (Friday) =NETWORKDAYS(A2, B2) 6
3 2023-11-01 (Wednesday) 2023-11-02 (Thursday) =NETWORKDAYS(A3, B3) 2

In the first example, the calendar span is 8 days, but because Saturday (Oct 21) and Sunday (Oct 22) are skipped, the formula returns 6 working days (Friday, Monday, Tuesday, Wednesday, Thursday, Friday).

Handling Custom Weekends: The NETWORKDAYS.INTL Function

The standard NETWORKDAYS function assumes that weekends fall on Saturday and Sunday. However, in our globalized economy, this isn't always the case. Some retail, manufacturing, or healthcare industries work on weekends and take other days off. Additionally, countries in the Middle East, for instance, historically observed weekends on Friday and Saturday.

To handle these non-standard schedules, Excel introduced the NETWORKDAYS.INTL function.

Syntax of NETWORKDAYS.INTL

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

The third argument, [weekend], is a number or string that specifies when the weekends occur. If you omit this argument, it defaults to 1 (Saturday and Sunday).

Weekend Parameter Options (Numeric)

You can use the following numeric codes to define your weekend:

Weekend Code Days Excluded as Weekend
1 (or omitted)Saturday and Sunday
2Sunday and Monday
3Monday and Tuesday
11Sunday only
12Monday only
16Friday only

Using Binary Strings for Custom Weekends

If your work schedule is highly customized-for example, you work Tuesday, Thursday, and Saturday, and take the other days off-you can use a binary string of seven characters. This string always starts on Monday and ends on Sunday. A 0 represents a workday, while a 1 represents a weekend (day off).

  • Standard weekend (Sat/Sun): "0000011" (Mon-Fri are 0s, Sat-Sun are 1s)
  • Sunday only weekend: "0000001"
  • Off-days on Tuesday and Thursday: "0101000"

To write a formula that excludes only Sundays, use: =NETWORKDAYS.INTL(A2, B2, 11) or =NETWORKDAYS.INTL(A2, B2, "0000001").

Excluding Holidays from Your Date Calculations

In addition to weekends, your business calculations likely need to bypass public holidays like New Year's Day, Independence Day, or Thanksgiving. Failing to exclude holidays can skew your SLA performance metrics.

To exclude holidays, follow these simple steps:

  1. Create a list of holiday dates in a separate section of your worksheet (e.g., column E, cells E2:E10).
  2. Reference this range as the third argument in your NETWORKDAYS formula (or the fourth argument in NETWORKDAYS.INTL).

Here is an example formula:

=NETWORKDAYS(A2, B2, $E$2:$E$10)

Pro Tip: Always use absolute cell references (with dollar signs like $E$2:$E$10) when referencing your holiday list. This ensures that when you drag the formula down to calculate days for other rows, your holiday reference range remains locked and does not shift.

Advanced Scenario: Subtracting Dates with Fractional Days (Hours)

Sometimes, your date cells contain timestamps (e.g., 10/23/2023 09:00 AM). Standard NETWORKDAYS only evaluates the date portion and completely ignores the time component, which can lead to inaccuracies when calculating precise turn-around times.

If you need to calculate the precise difference in hours/days while excluding weekends, you can combine NETWORKDAYS with standard time math. If we assume a 24-hour working cycle, you can calculate the exact fractional working days using this approach:

=NETWORKDAYS(A2, B2) - 1 + MOD(B2, 1) - MOD(A2, 1)

Here is how this advanced formula works:

  • NETWORKDAYS(A2, B2) - 1: Calculates the whole working days between the start and end dates (excluding weekends) but strips away the influence of the start and end fractional days.
  • MOD(B2, 1): Extracts only the time fraction of the end date (e.g., 0.5 for 12:00 PM).
  • MOD(A2, 1): Extracts only the time fraction of the start date.

Common Troubleshooting and Errors

If your formula isn't outputting the results you expect, double-check these common problem areas:

1. The #VALUE! Error

This error almost always occurs because one or both of the dates in your formula are stored as text strings rather than actual numbers/dates. To fix this, convert the cells to proper date format. You can check if Excel recognizes a date by looking at its alignment; by default, Excel aligns text to the left and numerical dates to the right of the cell.

2. Negative Values

If your start_date is chronologically later than your end_date, Excel will return a negative number (e.g., -5). If you want to prevent negative values and output a zero instead when data entry is irregular, you can wrap your formula in a MAX function:

=MAX(0, NETWORKDAYS(A2, B2))

Summary

Subtracting two dates while omitting weekends is an essential workflow tool in Excel. For standard Monday-to-Friday business environments, use the standard NETWORKDAYS function. If you manage flexible shifts or localized international teams, use NETWORKDAYS.INTL to program custom rest days. Pair either formula with a robust holiday range to ensure your performance tracking remains incredibly accurate year-round.

Disclaimer:
The documents and templates provided on this page are for informational and illustrative purposes only. They do not constitute professional, legal, or financial advice, and should not be relied upon as such. Because individual circumstances and regulatory requirements vary, these materials may not be suitable for your specific needs. We recommend consulting with a qualified professional before adapting or using any of these examples for official or commercial purposes.