Date & Time
Count Working Days With Custom Weekend Masks (Closed-Form NETWORKDAYS.INTL)
Calculate net working days between two dates under any custom 2-day weekend schedule (such as Friday–Saturday or Sunday–Monday) and subtract non-weekend public holidays using exact modular arithmetic.
Exact O(1) weekday counting for any regional weekend pair
Standard NETWORKDAYS hardcodes Saturday and Sunday as the weekend, which miscounts SLA and payroll schedules for regional operations observing Friday–Saturday weekends (ISO weekdays 5 and 6) or retail hospitality teams off on Sunday–Monday (ISO weekdays 7 and 1).
For any inclusive interval [startDt, endDt] and any ISO weekday w in 1..7 (1 = Monday .. 7 = Sunday), the first occurrence of weekday w on or after startDt is firstW = startDt + MOD(w - WEEKDAY(startDt, 2), 7), and its exact occurrence count is IF(endDt < firstW, 0, INT((endDt - firstW) / 7) + 1). Subtracting the two custom weekend counts and any public holidays falling on active workdays yields exact NETWORKDAYS.INTL results across multi-year spans.
| Window [2026-05-01..2026-05-17] | Weekend Pair (ISO 1..7) | Calendar Days | Weekend Days | Net Working Days (Excl. Holidays) |
|---|---|---|---|---|
| May 1 (Fri) .. May 17 (Sun) | Fri (5) & Sat (6) | 17 | 3 Fri + 3 Sat = 6 | 11 (minus Sun May 10 holiday = 10) |
| May 1 (Fri) .. May 17 (Sun) | Sun (7) & Mon (1) | 17 | 3 Sun + 2 Mon = 5 | 12 (Sun May 10 already weekend -> 12) |
| May 1 (Fri) .. May 17 (Sun) | Sat (6) & Sun (7) | 17 | 3 Sat + 3 Sun = 6 | 11 (matches standard NETWORKDAYS) |
Custom Two-Day Weekend Working-Day Count (Gross Workdays)
Counts active workdays in [B2, B3] excluding custom ISO weekend weekdays B4 and B5 (1 = Mon .. 7 = Sun).
=IF(B3 < B2, "Invalid Range", LET(cal, B3 - B2 + 1, f1, B2 + MOD(B4 - WEEKDAY(B2, 2), 7), c1, IF(B3 < f1, 0, INT((B3 - f1) / 7) + 1), f2, B2 + MOD(B5 - WEEKDAY(B2, 2), 7), c2, IF(B3 < f2, 0, INT((B3 - f2) / 7) + 1), cal - c1 - IF(B4 = B5, 0, c2)))Net Working Days Subtracting Non-Weekend Holidays
Subtracts holiday B6 only when B6 falls inside [B2, B3] and does not coincide with either custom weekend day B4 or B5.
=LET(cal, B3 - B2 + 1, f1, B2 + MOD(B4 - WEEKDAY(B2, 2), 7), c1, IF(B3 < f1, 0, INT((B3 - f1) / 7) + 1), f2, B2 + MOD(B5 - WEEKDAY(B2, 2), 7), c2, IF(B3 < f2, 0, INT((B3 - f2) / 7) + 1), holHit, IF(AND(B6 >= B2, B6 <= B3, WEEKDAY(B6, 2) <> B4, WEEKDAY(B6, 2) <> B5), 1, 0), cal - c1 - IF(B4 = B5, 0, c2) - holHit)Try the example
Use the original values or change them to test your understanding.