There are 22 business days between 1 and 31 December 2026 in the United States, counting both ends: 23 weekdays minus Christmas Day on Friday 25 December. Count the weekdays in your range, then subtract the public holidays that fall on them.
Do it with the API
Narwhal has no business-day endpoint. Read the public holidays for a country and year with GET /v1/calendars/holidays/{country}/{year}, then count the weekdays whose dates are absent from that list. Here, a business day means Monday to Friday that is not a public holiday in the chosen country. The calculation needs one request per country and year, including a separate request for each year in a range that crosses years.
- Get your API key Get a free API key and keep it in the
NARWHAL_API_KEYenvironment variable. The script sends it in theAuthorization: Bearer YOUR_KEYheader tohttps://api.narwhalapi.com. - Choose the country and date range Use an ISO 3166 alpha-3 country code, such as
USA,GBR,JPN,DEUorIDN. The example usesUSAand counts from 1 through 31 December 2026, with both dates included. - Count weekdays outside the holiday set Use this Python script with your chosen dates. It collects holiday dates for every year in the range into a set, then counts only Monday to Friday dates that are absent from the set.Python, business days between two dates
import os from datetime import date, timedelta import requests API = "https://api.narwhalapi.com" HEADERS = {"Authorization": f"Bearer {os.environ['NARWHAL_API_KEY']}"} def holidays(country: str, year: int) -> set[str]: r = requests.get(f"{API}/v1/calendars/holidays/{country}/{year}", headers=HEADERS, timeout=10) r.raise_for_status() return {h["date"] for h in r.json()["holidays"]} def business_days(start: date, end: date, country: str = "USA") -> int: """Business days from start to end, counting both ends, like NETWORKDAYS.""" off = set() for year in range(start.year, end.year + 1): off |= holidays(country, year) days = (start + timedelta(n) for n in range((end - start).days + 1)) return sum(1 for d in days if d.weekday() < 5 and d.isoformat() not in off) print(business_days(date(2026, 12, 1), date(2026, 12, 31))) - Read the result for your range For 1 to 31 December 2026 in the United States, the script prints
22. Future years are available while their calendars are published; an unpublished calendar returns404 calendar_not_published.
The United States federal government calendar for 2026 has 11 holiday dates: 1 January, 19 January, 16 February, 25 May, 19 June, 3 July, 7 September, 12 October, 11 November, 26 November and 25 December. For a December-only range in 2026, Christmas Day is the date from this annual list that falls within the range.
Do it in a sheet or without code
In Excel or Google Sheets, put the holiday dates in a column and use that column as the Holidays range. Copy the dates from the country’s page on Narwhal holiday calendars, or take them from the API response. The formula counts weekdays between the dates and leaves out dates in your holiday column. Both ends of the range are included.
=NETWORKDAYS(DATE(2026,12,1), DATE(2026,12,31), Holidays)For December 2026 in the United States, a one-cell Holidays range containing 2026-12-25 gives 22. Without the holiday range, the formula gives 23, because it counts weekdays without subtracting Christmas Day. Keep the holiday column tied to the country and year you are counting. A range across years needs the holiday dates for each year.
For a count without a script or spreadsheet formula, use the country’s calendar page to find its public holiday dates. Count Monday to Friday dates in your chosen range, then subtract the listed holidays that fall on those weekdays.
Which option to use when
| Situation | Best option | Why |
|---|---|---|
| A one-off count with a few dates | Spreadsheet NETWORKDAYS with a holiday column | The formula includes both ends and subtracts the supplied holiday dates |
| Many date pairs or a nightly job | Python script, with holidays fetched once per country and year | Reuse the holiday set for date pairs in the same country and year |
| Regional or bank-only business days | Use scope and subdivision_codes, or your own holiday list | The holiday list must match the calendar you need |
Does the count include the start and end date?
Yes. The Python script and NETWORKDAYS include both the start and end date. Each boundary date still has to qualify as a business day: a Saturday, Sunday or public holiday adds nothing to the total. Including both ends describes the range; the weekday and holiday rules determine which dates count.
To count nights or exclude the end date, subtract 1 when the end date is a business day. If the end date is already excluded as a weekend or public holiday, leave the business-day total unchanged.
What changes when a holiday falls on a weekend?
Use the observed date where the country observes one. The API marks a substitute day with observed: true. In the United States calendar for 2026, Independence Day is listed on Friday 3 July because 4 July is a Saturday.
For 1 to 31 July 2026, exclude Friday 3 July from the weekday count. Saturday 4 July is already outside the Monday to Friday count, so it does not need a further subtraction. Use the date supplied by the calendar for the observed holiday.
What if weekends or regional holidays differ?
Use the weekend pattern and holiday scope that match your calendar. The Python script assumes Saturday and Sunday are weekends. For a Friday-Saturday weekend in a spreadsheet, use NETWORKDAYS.INTL(start, end, 7, Holidays).
Holiday entries have date, name, scope and subdivision_codes, sometimes with local_name. Use the scope and subdivision fields for regional calendars, then de-duplicate by date. For 2026, GBR has separate entries for England and Wales, Northern Ireland and Scotland: 28 rows with 14 distinct dates.
Bank, exchange and company calendars can differ from public holiday calendars. The United States list has federal_government scope; the NYSE closes on Good Friday, 3 April 2026, which is absent from that federal list. Use your own list when the required calendar differs.
Worked example: 1 to 31 December 2026, United States
December 2026 has 31 days and starts on Tuesday 1 December. Count both ends of the month to get 23 weekdays. Christmas Day falls on Friday 25 December 2026, so subtract that weekday holiday.
| Range in the United States | Weekdays | Weekday holidays | Business days |
|---|---|---|---|
| 1 to 31 December 2026 | 23 | 1, Christmas Day on 25 December | 23 - 1 = 22 |
| 20 November to 4 December 2026 | 11 | 1, Thanksgiving on 26 November | 11 - 1 = 10 |
For the second range, include 20 November and 4 December 2026. Its weekdays are 20, 23, 24, 25, 26, 27 and 30 November, followed by 1, 2, 3 and 4 December. That gives 11 weekdays. Thanksgiving falls on Thursday 26 November 2026; subtract it to get 10 business days.
Published .
