COUPDAYS Function (LibreOffice Calc)
The COUPDAYS function returns the number of days in the coupon period containing the settlement date. It is essential for bond valuation, accrued interest calculations, and financial modeling involving coupon schedules.
Compatibility
▾| Excel | ✔ |
| Gnumeric | ✔ |
| Google_sheets | ✔ |
| Libreoffice | ✔ |
| Numbers | ✔ |
| Onlyoffice | ✔ |
| Openoffice | ✔ |
| Wps | ✔ |
| Zoho | ✔ |
What the COUPDAYS Function Does ▾
- Returns the total number of days in the coupon period
- Uses coupon frequency (annual, semiannual, quarterly)
- Supports multiple day‑count basis systems
- Works with real dates, serial numbers, and DATEVALUE
It is designed to be precise, finance‑grade, and Excel‑compatible.
Syntax ▾
COUPDAYS(settlement; maturity; frequency; [basis])
Arguments
-
settlement:
The date the security is traded to the buyer. -
maturity:
The date the security matures. -
frequency:
Number of coupon payments per year:1= annual2= semiannual4= quarterly
-
basis (optional):
Day-count convention:
| basis | Day-count convention |
|---|---|
| 0 | US 30/360 |
| 1 | Actual/Actual |
| 2 | Actual/360 |
| 3 | Actual/365 |
| 4 | European 30/360 |
Basic Examples ▾
Days in coupon period (semiannual)
=COUPDAYS("2024-03-15"; "2026-03-15"; 2)
Using Actual/Actual
=COUPDAYS(A1; A2; 2; 1)
Using text dates
=COUPDAYS(DATEVALUE(A1); DATEVALUE(A2); 2)
Advanced Examples ▾
Days in coupon period for quarterly bond
=COUPDAYS("2024-02-10"; "2025-02-10"; 4)
Days in coupon period from imported CSV timestamps
=COUPDAYS(DATEVALUE(LEFT(A1;10)); DATEVALUE(LEFT(A2;10)); Frequency)
Days in coupon period from Excel serial dates stored as text
=COUPDAYS(DATE(1899;12;30)+VALUE(A1); DATE(1899;12;30)+VALUE(A2); Frequency)
Combine with COUPDAYSNC to compute fraction of coupon remaining
=COUPDAYSNC(A1; A2; Freq) / COUPDAYS(A1; A2; Freq)
Combine with ACCRINT to compute accrued interest manually
=CouponRate * Par * (COUPDAYS(A1;A2;Freq) - COUPDAYSNC(A1;A2;Freq)) / COUPDAYS(A1;A2;Freq)
Edge Cases and Behavior Details ▾
COUPDAYS returns a numeric value (days)
Accepts:
- Real dates
- Serial numbers
- DATEVALUE outputs
Invalid text → Err:502
Behavior details
- Settlement < Maturity must hold
- Frequency must be 1, 2, or 4
- Basis must be 0–4
- Time components ignored
- Coupon schedule is calculated backward from maturity
COUPDAYS of an error → error propagates
Common Errors and Fixes ▾
Err:502 — Invalid argument
Cause:
- Dates not recognized
- Frequency not 1, 2, or 4
- Basis outside 0–4
Fix:
- Wrap dates with DATEVALUE
- Validate frequency and basis
Err:504 — Invalid date sequence
Cause:
- Settlement after maturity
Fix:
- Correct date order
Unexpected coupon length
Cause:
- Wrong frequency
- Wrong day-count basis
Fix:
- Verify coupon schedule
- Confirm basis selection
Best Practices ▾
- Use Actual/Actual (basis 1) for most government bonds
- Use 30/360 for corporate bonds
- Normalize text dates with DATEVALUE
- Validate coupon frequency carefully
- Use COUPDAYS with COUPDAYSNC, COUPNUM, COUPPCD, and COUPNCD for full coupon modeling
COUPDAYS is your coupon‑period length engine — essential for accrued interest, price, yield, and any professional fixed‑income model.
Related Patterns and Alternatives ▾
- Use COUPDAYSNC for days from settlement to next coupon
- Use COUPNUM for number of coupon periods
- Use COUPPCD for previous coupon date
- Use COUPNCD for next coupon date
- Use ACCRINT for accrued interest
- Use PRICE and YIELD for bond valuation
By mastering COUPDAYS and its companion functions, you can build powerful, accurate, and fully professional fixed‑income models in LibreOffice Calc.