COUPDAYBS Function in ONLYOFFICE Spreadsheet Editor: Syntax and Examples
Count elapsed coupon-period days under the selected basis, with actual-calendar and 30/360 examples.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer
COUPDAYBS returns the day count from the start of the current coupon period to settlement. For settlement April 15, 2026, maturity December 15, 2028 and semiannual coupons, =COUPDAYBS(DATE(2026,4,15),DATE(2028,12,15),2,1) is expected to return 121 actual days. It does not return a coupon date or an interest amount.
Syntax and argument rules
=COUPDAYBS(settlement, maturity, frequency, [basis])
| Argument | Meaning and permitted inputs |
|---|---|
settlement |
Settlement date; use a numeric date created with DATE or a cell containing one |
maturity |
Maturity date, strictly later than settlement |
frequency |
Payments per year: 1 annual, 2 semiannual or 4 quarterly |
basis |
Optional day-count code, default 0 in the inspected implementation |
The official COUPDAYBS reference lists basis 0 as US (NASD) 30/360, 1 as actual/actual, 2 as actual/360, 3 as actual/365 and 4 as European 30/360. Brackets indicate an optional argument; do not type them. Use integer frequency and basis values deliberately rather than relying on input conversion.
These functions infer a regular schedule from maturity and frequency. They do not take an issue date, first coupon date, holiday calendar or irregular-period flag. A contractual payment schedule with odd first/last coupons or business-day adjustments needs separate treatment.
Reproducible worksheet setup
Enter the following in a new worksheet. DATE avoids ambiguity between month/day and day/month date text.
| Cell | Input | Meaning |
|---|---|---|
| A2 | =DATE(2026,4,15) |
Settlement, April 15, 2026 |
| B2 | =DATE(2028,12,15) |
Maturity, December 15, 2028 |
| C2 | 2 |
Semiannual coupons |
| D2 | 1 |
Actual/actual basis |
Put =COUPDAYBS(A2,B2,C2,D2) in E2. The expected regular schedule around settlement runs from December 15, 2025 to June 15, 2026. All examples in this guide are documentation/source-derived expectations with independent calendar arithmetic; none was tested in the application or its calculation engine.
Worked results: elapsed days are basis-dependent
| Formula using the setup | Expected days | Reason |
|---|---|---|
=COUPDAYBS(A2,B2,2,0) |
120 | Four 30-day months from December 15 to April 15 |
=COUPDAYBS(A2,B2,2,1) |
121 | Actual calendar difference |
=COUPDAYBS(A2,B2,2,2) |
121 | Actual numerator under actual/360 |
=COUPDAYBS(A2,B2,2,3) |
121 | Actual numerator under actual/365 |
=COUPDAYBS(A2,B2,2,4) |
120 | European 30/360; no month-end adjustment involved here |
=COUPDAYBS(A2,B2,2) |
120 | Omitted basis defaults to 0 |
Independent calendar subtraction gives 31 days from December 15 to January 15, 31 to February 15, 28 to March 15 and 31 to April 15: 121. The coupon helper locates the previous schedule boundary and calls the basis-sensitive day-difference helper.
For a leap-year comparison, =COUPDAYBS(DATE(2024,4,15),DATE(2025,12,15),2,1) is expected to return 122, since the period begins December 15, 2023 and contains February 29, 2024. On a coupon boundary itself, =COUPDAYBS(DATE(2026,6,15),B2,2,1) is expected to return 0, because the current period starts on settlement.
Practical extension
For a fictional regular bond with face amount 1,000 and annual coupon rate 6%, a semiannual coupon amount is 1,000×0.06/2 = 30. Under the worked actual/actual model, the elapsed fraction is 121/182, giving illustrative accrued interest 30×121/182 ≈ 19.9450549451. The denominator is the full December-to-June coupon period, not 365 and not the number of days remaining.
This arithmetic explains a model, not a recommendation or a universal settlement amount. Contract-specific ex-coupon rules and irregular periods are outside the four inputs. Do not use COUPDAYBS alone as if it returned money. Keep its day-count basis consistent with the rest of the pricing model.
Errors, date inputs and schedule boundaries
The 10.0.0.169 coupon wrappers floor numeric date serials, frequency and basis before validation. Thus a time fraction is discarded. This does not mean malformed text or fractional settings are recommended inputs.
- Settlement equal to or later than maturity returns
#NUM!in the inspected source. For example, with A2 and B2 from the setup,=COUPDAYBS(B2,B2,2,1)follows that guard. - An unsupported frequency such as 3 or basis such as 5 returns
#NUM!after integer conversion. - Boolean scalar arguments and multi-cell ranges are rejected with
#VALUE!in these wrappers. Use individual input cells. - An empty required scalar input is handled as
#N/A; omitted basis defaults to 0. Do not assume a blank referenced basis cell has the same treatment as omitting the argument. - Dates before the supported serial range and locale-dependent date-text coercion require separate checking. The examples use modern DATE values rather than historical serial edge cases.
Month-end and leap-day schedules deserve special attention. The date helper preserves month end when adding months from a month-end date, while year changes use a UTC year setter. A February 29 maturity and an arbitrary month-end sequence should therefore be checked against the contract rather than inferred from a fixed number of days. The 15th-of-month examples avoid those edge cases. No holiday or weekend adjustment is made by the inspected coupon helpers.
Availability and compatibility
Checked October 18, 2026 against the current official help and SDKJS source tagged v10.0.0.169. Desktop Editors 10.0 was released October 13, 2026. The sources do not establish this function’s first introduction version, and do not mark it retired or deprecated.
The source tag matches the installed version/build designation; it does not establish native execution or byte-for-byte identity of the entire application. Older versions, mobile clients, server deployments and imported-workbook behavior were not tested. Formula examples use English names and comma separators; adapt separators to your editor’s settings. Date serial examples, where shown, assume the 1900 date system; a different workbook date system changes the raw serial, not the intended calendar label.