Financial functions

COUPDAYS

Matches all 5,591 recorded answers

Recorded: 5,584 in the answer bank and 7 workbook cells. How we measure this · See the Rust code

Local names in 40 languages
LanguageName in Excel
ArabicCOUPDAYS
BulgarianCOUPDAYS
CzechCOUPDAYS
DanishKUPONDAGE.A
GermanCOUPDAYS
GreekCOUPDAYS
English (Australia)COUPDAYS
English (United Kingdom)COUPDAYS
English (United States)COUPDAYS
SpanishCOUPDACUPON.DIAS
EstonianCOUPDAYS
FinnishKORKOPÄIVÄT
FrenchNB.JOURS.COUPONS
HebrewCOUPDAYS
CroatianCOUPDAYS
HungarianSZELVÉNYIDŐ
IndonesianCOUPDAYS
ItalianCOUPDAYS
JapaneseCOUPDAYS
KoreanCOUPDAYS
LithuanianCOUPDAYS
LatvianCOUPDAYS
NorwegianOBLIG.DAGER
DutchCOUP.DAGEN
PolishWYPŁ.DNI
Portuguese (Brazil)COUPDAYS
Portuguese (Portugal)CUPDIAS
RomanianCOUPDAYS
RussianДНЕЙКУПОН
SlovakCOUPDAYS
SlovenianCOUPDAYS
Serbian (Latin)COUPDAYS
SwedishKUPDAGB
ThaiCOUPDAYS
TurkishKUPONGÜN işlevi
UkrainianCOUPDAYS
VietnameseCOUPDAYS
Chinese (Simplified)COUPDAYS
Chinese (Hong Kong)COUPDAYS
Chinese (Traditional)COUPDAYS

Names from Microsoft's support site.

What it does

COUPDAYS(settlement, maturity, frequency, [basis])

COUPDAYS(settlement, maturity, frequency, [basis]) returns the number of days in the coupon period that contains the settlement date.

It is the denominator of every accrual fraction in bond arithmetic. Accrued interest is COUPDAYBS / COUPDAYS of a coupon; the discounting exponent in PRICE is COUPDAYSNC / COUPDAYS. Get this function wrong and every price and yield built on it is wrong by the same proportion.

The coupon period is determined by the schedule described on COUPNCD: coupon dates run backwards from maturity in steps of 12/frequency months, and settlement selects one period from that ladder. On basis 1 Excel's period comes from its own walk back from maturity (FN-COUPDAYS-001).

Arguments

COUPDAYS(settlement, maturity, frequency, [basis]) — the family's shared four arguments; Microsoft's argument descriptions and the five-row basis table are quoted on COUPNCD.

ArgumentMeaningRequired?
settlementThe security's settlement date.Required
maturityThe security's maturity date.Required
frequencyCoupon payments per year: 1, 2 or 4.Required
basisThe day-count basis, 0–4.Optional, defaults to 0

Unlike its five siblings, COUPDAYS genuinely depends on basis in the strongest possible way: basis chooses between "measure the calendar" and "quote a convention". Omitting basis asks for 30/360, and gets a flat 360/frequency for every period of every bond.

Microsoft documents that "All arguments are truncated to integers."

Try it

Input cells (optional)

Example: {"B2": 3, "B3": 4}. A1 holds the formula. Other cells need values before a formula can read them.

Enter a formula, then calculate.

Runs locally in your browser with OneCalc. Its answer may differ from Excel. Use English function names and commas between arguments.

Quirks

Why the answer is often not a whole number of days

Here is the thing that surprises readers: COUPDAYS does not always count days. For four of the five bases it returns a convention, and the convention need not be an integer.

basisWhat COUPDAYS returns
0 — US (NASD) 30/360360 / frequency
1 — Actual/actualthe actual calendar length of the period containing settlement
2 — Actual/360360 / frequency
3 — Actual/365365 / frequency
4 — European 30/360360 / frequency

So at frequency 2 the answers are 180, 180, 182.5 and 180 for bases 0, 2, 3 and 4 — and 182.5 is not a number of days that any calendar contains. Under basis 1 the answer really is a day count, and it varies from period to period: semiannual periods are 181, 182, 183 or 184 days long depending on which months they span and whether a leap day falls inside.

The logic is coherent once stated: a /360 or /365 basis declares a year length, and the coupon period is by definition a 1/frequency share of that declared year. Only actual/actual declines to declare one and measures the calendar instead. But the practical consequence is worth stating plainly: basis 2 is "actual/360", and yet COUPDAYS under basis 2 ignores the actual calendar entirely. The "actual" in the name governs the numerator, not the denominator.

The additivity that fails

The obvious identity is

COUPDAYBS + COUPDAYSNC  =  COUPDAYS

The reason follows directly from the table above and the corresponding one on COUPDAYBS: under bases 2 and 3 the two numerator functions count real calendar days, while COUPDAYS returns a declared 180 or 182.5. A 184-day real period reported as a 180-day period cannot have its two halves add up.

This is not a defect in the family so much as a fault line running through it, and it has already produced observable divergence upstream. The Handbook's research record documents a case in the same bond model where Excel's PRICE derives its days-to-next-coupon as period length minus accrued days rather than counting them directly — which agrees with COUPDAYSNC on 30/360 and actual/actual bases, apart from the basis 0 cases of FN-COUPDAYSNC-001, and disagrees with it, by whole days, on actual/360 and actual/365. Excel published both numbers, in the same workbook, for the same bond. That episode is exactly this additivity failure, seen from the consumer's side.

The reader's practical rule: on bases 0, 2 and 3, do not derive any of the three day counts from the other two. Ask for each one.

Result and edge cases

Returns a Number, which may be fractional (182.5 at basis 3, frequency 2) and is not always a possible day count.

  • Basis 1 across a leap day gives a longer period than the same schedule position in a non-leap year. This is the only basis under which COUPDAYS varies with the settlement date at all.
  • frequency 1, 2, 4 are the only admitted values, so the constants are 360, 180, 90 (bases 0, 2, 4) and 365, 182.5, 91.25 (basis 3).
  • settlement ≥ maturity is a documented error.
  • Empty, missing and error arguments follow the shared call model; see The value universe.

Errors

Documented on Microsoft's Learn page for this function, in these words (it says "generates an error" without naming a worksheet error value):

Condition (documented)Documented outcome
settlement or maturity is not a valid dateerror
frequency is any number other than 1, 2 or 4error
basis < 0 or basis > 4error
settlement ≥ maturityerror

On basis 1 COUPDAYS walks back from maturity by its own rule, not COUPPCD to COUPNCD

On basis 1 (actual/actual) COUPDAYS does not always equal COUPNCD minus COUPPCD. Its rule: start at maturity and step back by 12/frequency months. Each step keeps the day of the month and clamps it to the length of the target month, and the clamped date is the start of the next step, so passing through February lowers the day for every earlier date. Stop at the last date still after settlement, call it next. The answer is the number of actual days from one period before next up to next, and this last step keeps month ends: if next is the last day of its month, the start is the last day of its month. On the other bases the answer is 360/frequency (bases 0, 2, 4) or 365/frequency (basis 3). With this rule, all 5,584 recorded rows match (4,072 distinct inputs): 5,568 numbers and 16 #NUM!, from Excel builds 20131 and 20430. Of the 967 basis 1 rows, 81 (49 distinct inputs) differ from the day count between the dates of a schedule anchored on maturity with month ends kept. For maturity 1998-06-30 with semi-annual coupons, COUPDAYS(35748,35976,2,1) is 183, from 1997-06-30 to 1997-12-30; the anchored schedule gives 184. In one recorded case all three functions were read on the same inputs: COUPNCD(44043,2958465,2,1) less COUPPCD is 44196 - 44012 = 184, and COUPDAYS is 183.

Explanation (inferred): The rule reproduces every recorded row; that Excel's code works this way is inferred. For basis 1 no settlement or maturity before serial 61, where Excel's calendar differs from the Gregorian one, is in the recorded rows.

FormulaExcelMathematical value
COUPDAYS(35748, 35976, 2, 1)
Excel 16.0 build 20430, Windows 64-bit, AMD Ryzen 7 4800H
Inputs and reference value

Number supplied through a cell.

settlement: 35748
0x40e1748000000000

maturity: 35976
0x40e1910000000000

frequency: 2
0x4000000000000000

basis: 1
0x3ff0000000000000

183
0x4066e00000000000
—
COUPDAYS(36452, 36891, 4, 1)
Excel 16.0 build 20430, Windows 64-bit, AMD Ryzen 7 4800H
Inputs and reference value

Number supplied through a cell.

settlement: 36452
0x40e1cc8000000000

maturity: 36891
0x40e2036000000000

frequency: 4
0x4010000000000000

basis: 1
0x3ff0000000000000

91
0x4056c00000000000
—
COUPDAYS(36812, 47907, 4, 1)
Excel 16.0 build 20430, Windows 64-bit, AMD Ryzen 7 4800H
Inputs and reference value

Number supplied through a cell.

settlement: 36812
0x40e1f98000000000

maturity: 47907
0x40e7646000000000

frequency: 4
0x4010000000000000

basis: 1
0x3ff0000000000000

92
0x4057000000000000
—
COUPDAYS(37015, 38137, 4, 1)
Excel 16.0 build 20430, Windows 64-bit, AMD Ryzen 7 4800H
Inputs and reference value

Number supplied through a cell.

settlement: 37015
0x40e212e000000000

maturity: 38137
0x40e29f2000000000

frequency: 4
0x4010000000000000

basis: 1
0x3ff0000000000000

89
0x4056400000000000
—
COUPDAYS(38044, 38411, 2, 1)
Excel 16.0 build 20430, Windows 64-bit, AMD Ryzen 7 4800H
Inputs and reference value

Number supplied through a cell.

settlement: 38044
0x40e2938000000000

maturity: 38411
0x40e2c16000000000

frequency: 2
0x4000000000000000

basis: 1
0x3ff0000000000000

184
0x4067000000000000
—
COUPDAYS(34911, 35216, 2, 1)
Excel 16.0 build 20430, Windows 64-bit, AMD Ryzen 7 4800H
Inputs and reference value

Number supplied through a cell.

settlement: 34911
0x40e10be000000000

maturity: 35216
0x40e1320000000000

frequency: 2
0x4000000000000000

basis: 1
0x3ff0000000000000

183
0x4066e00000000000
—
COUPPCD(44043, 2958465, 2, 1)
Excel 16.0 build 20430, Windows 64-bit, AMD Ryzen 7 4800H
Inputs and reference value

Number supplied through a cell.

settlement: 44043
0x40e5816000000000

maturity: 2958465
0x4146924080000000

frequency: 2
0x4000000000000000

basis: 1
0x3ff0000000000000

44012
0x40e57d8000000000
—
COUPNCD(44043, 2958465, 2, 1)
Excel 16.0 build 20430, Windows 64-bit, AMD Ryzen 7 4800H
Inputs and reference value

Number supplied through a cell.

settlement: 44043
0x40e5816000000000

maturity: 2958465
0x4146924080000000

frequency: 2
0x4000000000000000

basis: 1
0x3ff0000000000000

44196
0x40e5948000000000
—
COUPDAYS(44043, 2958465, 2, 1)
Excel 16.0 build 20430, Windows 64-bit, AMD Ryzen 7 4800H
Inputs and reference value

Number supplied through a cell.

settlement: 44043
0x40e5816000000000

maturity: 2958465
0x4146924080000000

frequency: 2
0x4000000000000000

basis: 1
0x3ff0000000000000

183
0x4066e00000000000
—

Inputs, build details and evidence

On basis 0 COUPDAYSNC is not always COUPDAYS minus COUPDAYBS

On basis 0 (US 30/360), COUPDAYSNC is P - A. A is COUPDAYBS, the accrued days. P is a 30/360 count between the actual previous and next coupon dates, with day 31 and the last day of February both counted as day 30. COUPDAYS on basis 0 is always 360/frequency, but P need not be: when a coupon falls on the last day of February and maturity is not a month end, P can be 88, 89 or 92 for a quarter and 178 or 182 for a half year. So COUPDAYSNC(39923,50919,4,0), with coupons 2009-02-28 and 2009-05-29, is 39: P is 89 and A is 50, where 90 - 50 would give 40. With no coupon date before settlement in Excel's calendar, the period starts at serial 0: COUPDAYSNC(33,400,2,0) is 1, and for settlement 61, maturity 456 and annual coupons COUPDAYBS plus COUPDAYSNC is 90, not 360. This rule matches all 1,664 recorded number rows on basis 0, 733 of them chosen near February, month ends and the start of the calendar.

Explanation (inferred): The split into P and A reproduces every row; that Excel's code forms these two counts is inferred. For the February cases in this note only COUPDAYSNC is recorded: their A comes from the rule, not from a COUPDAYBS reading.

FormulaExcelMathematical value
COUPDAYSNC(39923, 50919, 4, 0)
Excel 16.0.20527.20088, Windows, bitness and CPU not recorded in this reading file
Inputs and reference value

Number supplied through a cell.

settlement: 39923
0x40e37e6000000000

maturity: 50919
0x40e8dce000000000

frequency: 4
0x4010000000000000

basis: 0
0x0000000000000000

39
0x4043800000000000
—
COUPDAYSNC(45986, 57038, 2, 0)
Excel 16.0.20527.20088, Windows, bitness and CPU not recorded in this reading file
Inputs and reference value

Number supplied through a cell.

settlement: 45986
0x40e6744000000000

maturity: 57038
0x40ebd9c000000000

frequency: 2
0x4000000000000000

basis: 0
0x0000000000000000

95
0x4057c00000000000
—
COUPDAYSNC(46478, 46627, 4, 0)
Excel 16.0.20527.20088, Windows, bitness and CPU not recorded in this reading file
Inputs and reference value

Number supplied through a cell.

settlement: 46478
0x40e6b1c000000000

maturity: 46627
0x40e6c46000000000

frequency: 4
0x4010000000000000

basis: 0
0x0000000000000000

57
0x404c800000000000
—
COUPDAYSNC(33, 400, 2, 0)
Excel 16.0.20527.20088, Windows, bitness and CPU not recorded in this reading file
Inputs and reference value

Number supplied through a cell.

settlement: 33
0x4040800000000000

maturity: 400
0x4079000000000000

frequency: 2
0x4000000000000000

basis: 0
0x0000000000000000

1
0x3ff0000000000000
—
COUPDAYBS(61, 456, 1, 0)
Excel 16.0.20527.20088, Windows, bitness and CPU not recorded in this reading file
Inputs and reference value

Number supplied through a cell.

settlement: 61
0x404e800000000000

maturity: 456
0x407c800000000000

frequency: 1
0x3ff0000000000000

basis: 0
0x0000000000000000

61
0x404e800000000000
—
COUPDAYSNC(61, 456, 1, 0)
Excel 16.0.20527.20088, Windows, bitness and CPU not recorded in this reading file
Inputs and reference value

Number supplied through a cell.

settlement: 61
0x404e800000000000

maturity: 456
0x407c800000000000

frequency: 1
0x3ff0000000000000

basis: 0
0x0000000000000000

29
0x403d000000000000
—

Inputs, build details and evidence

How to implement

Numerical notes

  1. Three of the five answers are exact in binary; one is not. 360, 180, 90, 365 and 91.25 are all exactly representable; 365/2 = 182.5 is exact too. In fact all ten constants are exactly representable, so COUPDAYS itself has no rounding error — but the quotients built from it do, and forming a / (365/frequency) is not the same as forming a × frequency / 365. A consumer targeting Excel compatibility must pin which.
  2. Basis 1's answer is an integer day count and can be computed in integer arithmetic throughout. Doing so removes a whole class of bugs.
  3. The period-start anchor for basis 1 is a decision. Whether the actual length is measured from the clamped period start or from the raw backward step is a real fork in the reference engine's own code. Excel's rule is in FN-COUPDAYS-001: a clamped walk back from maturity, with month ends kept only on the last step.
  4. Do not implement COUPDAYS as a subtraction of the two other counts, or vice versa. The additivity failure above means each of the three has to be computed on its own terms. The upstream research record shows what happens when a production implementation takes the shortcut.
  5. There is no argument reduction, no cancellation and no transcendental here. Every difficulty in this function is definitional.

Rust code

Show the CalcFunc source of this function

Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.

COUPDAYS · 4 lines · calc-func/src/catalogue/bonds.rs on GitHub
11 coupdays_fn "COUPDAYS" (3, 4) [V "settlement", V "maturity", V "frequency", V "basis"] |s, a, sv| {
    let (settlement, maturity, frequency, b) = coupon_args(s, a, sv)?;
    coupon_out(s, coupon::coupdays_kernel(settlement, maturity, frequency, b))
}
coupon_day_count · 14 lines · calc-func/src/ported/coupon_family.rs on GitHub
fn coupon_day_count(
    start: i64,
    end: i64,
    basis: CouponBasis,
    frequency: i64,
) -> Result<f64, WorksheetErrorCode> {
    match basis {
        CouponBasis::Us30_360 => Ok(360.0 / frequency as f64),
        CouponBasis::ActualActual => Ok(actual_days(start, end)),
        CouponBasis::Actual360 => Ok(360.0 / frequency as f64),
        CouponBasis::Actual365 => Ok(365.0 / frequency as f64),
        CouponBasis::European30_360 => Ok(360.0 / frequency as f64),
    }
}
coupdays_kernel · 30 lines · calc-func/src/ported/coupon_family.rs on GitHub
pub fn coupdays_kernel(
    settlement: f64,
    maturity: f64,
    frequency: f64,
    basis: Option<f64>,
) -> Result<f64, WorksheetErrorCode> {
    let ctx = parse_coupon_context(settlement, maturity, frequency, basis)?;
    if ctx.basis == CouponBasis::ActualActual {
        // COUPDAYS has its own recorded calendar interval. Walk backwards
        // with ordinary clamped month shifts; a February visit can reduce
        // the day used by every earlier step. At the next coupon, measure
        // one period backwards with month-end preservation. Reusing the
        // anchored COUPNCD/COUPPCD pair changes these integer day counts.
        // Original Excel20131/20430 readings:965/965 Actual/Actual outcomes in the
        // R24 finite Gregorian study. No numerical tolerance enters this rule.
        let mut next = ctx;
        loop {
            let previous = coupon_date_before_maturity(next, 1, false)
                .ok_or(WorksheetErrorCode::Num)?;
            if previous <= ctx.settlement {
                let start = coupon_date_before_maturity(next, 1, true)
                    .ok_or(WorksheetErrorCode::Num)?;
                return Ok(actual_days(start, next.maturity));
            }
            next.maturity = previous;
        }
    }
    let period = locate_coupon_period(ctx)?;
    coupon_day_count(period.previous, period.next, ctx.basis, ctx.frequency)
}

Kernels shared with other functions

Argument and result plumbing

  • fail catalogue/kit
  • num catalogue/kit

No implementation has been published with a Handbook test suite for this function.

Version differences

The recorded environments below distinguish a reading from a same-input comparison. Counts describe captured inputs in each environment; overlapping captures and comparisons are not totals of unique worksheet calls.

Excel 16.0 buildPlatform and CPUCaptured inputs
20131Windows, bitness not recorded, AMD Ryzen 7 4800H with Radeon Graphics1,060
20430Windows, 64-bit, AMD Ryzen 7 4800H with Radeon Graphics3,012

The record contains no same-input comparison between these environments. Reading different inputs on different builds does not establish either a version change or cross-build agreement.

Recorded environments and comparison details.

Excel 16.0 build 20430

Windows 64-bit, AMD Ryzen 7 4800H

COUPDAYS(35748, 35976, 2, 1) returned 183 (0x4066e00000000000). COUPDAYS(36452, 36891, 4, 1) returned 91 (0x4056c00000000000). 5 further recorded controls are attached. Inputs were supplied through cells using Value2. These are controls from this environment, not a same-input comparison with another build.

Observed formulas and results
  • COUPDAYS(35748, 35976, 2, 1) → 183
    0x4066e00000000000 (cell-value2)
  • COUPDAYS(36452, 36891, 4, 1) → 91
    0x4056c00000000000 (cell-value2)
  • COUPDAYS(36812, 47907, 4, 1) → 92
    0x4057000000000000 (cell-value2)
  • COUPDAYS(37015, 38137, 4, 1) → 89
    0x4056400000000000 (cell-value2)
  • COUPDAYS(38044, 38411, 2, 1) → 184
    0x4067000000000000 (cell-value2)
  • COUPDAYS(34911, 35216, 2, 1) → 183
    0x4066e00000000000 (cell-value2)
  • COUPDAYS(44043, 2958465, 2, 1) → 183
    0x4066e00000000000 (cell-value2)

Excel 16.0 build 20131

Windows, bitness not recorded, AMD Ryzen 7 4800H with Radeon Graphics

1,060 captured inputs are indexed for this environment. Capture dates: 2026-07-19 to 2026-07-19. This is a reading count, not a comparison with another build.

Excel 16.0 build 20430

Windows, 64-bit, AMD Ryzen 7 4800H with Radeon Graphics

3,012 captured inputs are indexed for this environment. Capture dates: 2026-09-24 to 2026-09-25. This is a reading count, not a comparison with another build.

Alternatives

Relationships

  • COUPDAYBS and COUPDAYSNC — the numerators this function is the denominator of. Read the additivity section above before assuming they sum to it.
  • COUPNCD and COUPPCD — the two dates that bound the period whose length this function reports. Note that COUPNCD − COUPPCD is the actual length, which equals COUPDAYS only under basis 1, and not always there: FN-COUPDAYS-001 records 184 against 183.
  • COUPNUM — how many such periods remain.
  • PRICE, YIELD, DURATION, MDURATION, ODDFPRICE — the consumers, all of which form COUPDAYSNC / COUPDAYS as a discounting exponent or COUPDAYBS / COUPDAYS as an accrual fraction.
  • YEARFRAC — the general day-count engine. COUPDAYS is not YEARFRAC scaled: YEARFRAC always measures a real interval, while COUPDAYS mostly quotes a convention.
  • Confused with: COUPNCD(...) − COUPPCD(...), which is the actual number of days in the period and differs from COUPDAYS on every basis except 1, and on basis 1 in the cases FN-COUPDAYS-001 records.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents