Excel NETWORKDAYS function: working days between dates API
Working days between two dates, both included, with holidays and any weekend, as Excel's NETWORKDAYS and NETWORKDAYS.INTL.
POST https://api.curatedapi.com/v1/calc/excel/networkdays
- Version 1
- MCP tool
calc_excel_networkdays - Try it in the browser
NETWORKDAYS.INTL(start_date, end_date, [weekend], [holidays]); with the default weekend it is NETWORKDAYS. Both dates count. Negative when end is before start.
Formula
days from start to end inclusive, less weekend days and holidays
- Arguments are named and ordered as in Excel. Excel computes in binary floating point; this API computes the exact value of the same formula and rounds it once, so it agrees with Excel to the digits Excel can show, and where Excel's own rounding error reaches the 15th digit this answer is the correct one.
- Dates are ISO 8601 (YYYY-MM-DD) from 1900-03-01 to 9999-12-31, so Excel's fictional 29 February 1900 never comes into play. Each date result also gives Excel's serial number (1900 date system).
Inputs
Send numbers as strings to keep every digit. options sets precision and rounding (see numbers and rounding).
| Input | Type | Description |
|---|---|---|
start_date required |
date (YYYY-MM-DD) | Start date. |
end_date required |
date (YYYY-MM-DD) | End date. |
holidays |
list of date (YYYY-MM-DD) default [] |
Dates that are not working days. Up to 1000 items. |
weekend |
string default 1 |
Weekend days, as in NETWORKDAYS.INTL: a weekend number ("1" Saturday and Sunday, "2" Sunday and Monday, ... "7" Friday and Saturday, "11" Sunday only, ... "17" Saturday only) or seven 0s and 1s starting on Monday, 1 for a weekend day ("0000011" is Saturday and Sunday). At most 7 characters. |
options.rounding |
half_even | half_up | half_down | up | down | ceiling | floor | Rounding mode applied once to each result. Default half_even. |
options.decimals |
integer | Round results to this many digits after the decimal point. |
options.significant_digits |
integer | Round results to this many significant digits. |
Result
Under result in the answer, next to exactness, precision, inputs, formula, references and warnings.
| Result | Type | Description |
|---|---|---|
days | integer | Working days. |
Examples
Microsoft's example: 1 October 2012 to 1 March 2013
curl https://api.curatedapi.com/v1/calc/excel/networkdays \
-H "Authorization: Bearer $CURATEDAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"start_date": "2012-10-01",
"end_date": "2013-03-01"
}'
{
"calculator": "excel/networkdays@1",
"result": {
"days": 110
},
"exactness": {},
"precision": {
"rounding": "half_even",
"decimals": 0
},
"inputs": {
"start_date": "2012-10-01",
"end_date": "2013-03-01",
"holidays": [],
"weekend": "1"
},
"formula": "days from start to end inclusive, less weekend days and holidays",
"references": [
{
"title": "Microsoft Excel NETWORKDAYS function",
"url": "https://support.microsoft.com/en-us/excel/functions/networkdays-function"
},
{
"title": "Microsoft Excel NETWORKDAYS.INTL function",
"url": "https://support.microsoft.com/en-us/excel/functions/networkdays-intl-function"
}
],
"warnings": []
}
Microsoft's example: the same span less three holidays
curl https://api.curatedapi.com/v1/calc/excel/networkdays \
-H "Authorization: Bearer $CURATEDAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"start_date": "2012-10-01",
"end_date": "2013-03-01",
"holidays": ["2012-11-22", "2012-12-04", "2013-01-21"]
}'
{
"calculator": "excel/networkdays@1",
"result": {
"days": 107
},
"exactness": {},
"precision": {
"rounding": "half_even",
"decimals": 0
},
"inputs": {
"start_date": "2012-10-01",
"end_date": "2013-03-01",
"holidays": [
"2012-11-22",
"2012-12-04",
"2013-01-21"
],
"weekend": "1"
},
"formula": "days from start to end inclusive, less weekend days and holidays",
"references": [
{
"title": "Microsoft Excel NETWORKDAYS function",
"url": "https://support.microsoft.com/en-us/excel/functions/networkdays-function"
},
{
"title": "Microsoft Excel NETWORKDAYS.INTL function",
"url": "https://support.microsoft.com/en-us/excel/functions/networkdays-intl-function"
}
],
"warnings": []
}
Microsoft's example (NETWORKDAYS.INTL): Friday-Saturday weekend
curl https://api.curatedapi.com/v1/calc/excel/networkdays \
-H "Authorization: Bearer $CURATEDAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"start_date": "2006-01-01",
"end_date": "2006-02-01",
"weekend": "7",
"holidays": ["2006-01-02", "2006-01-16"]
}'
{
"calculator": "excel/networkdays@1",
"result": {
"days": 22
},
"exactness": {},
"precision": {
"rounding": "half_even",
"decimals": 0
},
"inputs": {
"start_date": "2006-01-01",
"end_date": "2006-02-01",
"holidays": [
"2006-01-02",
"2006-01-16"
],
"weekend": "7"
},
"formula": "days from start to end inclusive, less weekend days and holidays",
"references": [
{
"title": "Microsoft Excel NETWORKDAYS function",
"url": "https://support.microsoft.com/en-us/excel/functions/networkdays-function"
},
{
"title": "Microsoft Excel NETWORKDAYS.INTL function",
"url": "https://support.microsoft.com/en-us/excel/functions/networkdays-intl-function"
}
],
"warnings": []
}
References
Results follow each calculator's documented rules and the sources listed. They are not financial, tax or legal advice. Check that the rules fit your case before you rely on a result. See the terms.
Errors share one format; see errors. Billing, retries and batches work the same for every endpoint.