Math and trigonometry functions

COMBINA

Matches all 40,995 recorded answers

Recorded: 40,991 in the answer bank and 4 workbook cells. How we measure this · See the Rust code

Local names in 40 languages
LanguageName in Excel
ArabicCOMBINA
BulgarianCOMBINA
CzechCOMBINA
DanishKOMBINA
GermanCOMBINA
GreekCOMBINA
English (Australia)COMBINA
English (United Kingdom)COMBINA
English (United States)COMBINA
SpanishCOMBINA
EstonianCOMBINA
FinnishKOMBINAATIO
FrenchCOMBINA
HebrewCOMBINA
CroatianCOMBINA
HungarianKOMBINÁCIÓK.ISM
IndonesianCOMBINA
ItalianCOMBINA
JapaneseCOMBINA
KoreanCOMBINA
LithuanianCOMBINA
LatvianCOMBINA
NorwegianCOMBINA
DutchCOMBIN.A
PolishKOMBINACJE.A
Portuguese (Brazil)COMBINA
Portuguese (Portugal)COMBIN.R
RomanianCOMBINA
RussianЧИСЛКОМБА
SlovakCOMBINA
SlovenianCOMBINA
Serbian (Latin)COMBINA
SwedishKOMBINA
ThaiCOMBINA
TurkishKOMBİNASYONA
UkrainianCOMBINA
VietnameseCOMBINA
Chinese (Simplified)COMBINA
Chinese (Hong Kong)COMBINA
Chinese (Traditional)COMBINA

Names from Microsoft's support site.

What it does

COMBINA(number, number_chosen)

COMBINA(number, number_chosen) counts combinations with repetition: the number of ways to choose k items from n types when the same type may be chosen more than once and order does not matter. This is the multiset coefficient, written ((n choose k)) in Stanley's notation.

Microsoft's page prints the equation directly, with N for number and M for number_chosen:

COMBINA(N, M) = (N + M - 1)! / ( M! (N - 1)! )

which is the same thing as the binomial coefficient

COMBINA(n, k) = C(n + k - 1, k) = C(n + k - 1, n - 1)

The identity is the stars and bars argument: a multiset of size k drawn from n types is determined by where you place n - 1 dividers among k + n - 1 positions.

PropertyStatement
Domain (documented)n ≥ 0, k ≥ 0, and n ≥ k
Rangepositive integers
ReductionCOMBINA(n, k) = C(n+k-1, k) — a binomial coefficient, always
BoundaryCOMBINA(n, 0) = 1; COMBINA(1, k) = 1; COMBINA(n, 1) = n
Generating function1/(1-x)^n = Σ_k COMBINA(n, k) x^k
Symmetrynone in (n, k); the underlying binomial's symmetry is k ↔ n-1

One documentation observation belongs here rather than buried below, because it is a genuine divergence between the mathematics and the published constraint. The multiset coefficient is defined for every n ≥ 1 and every k ≥ 0, with no requirement that n ≥ k — choosing five scoops from three flavours is a perfectly ordinary question, and the answer is C(7, 5) = 21. Microsoft's page nevertheless documents Number as having to be "greater than or equal to Number_chosen", and documents #NUM! when an argument is outside its constraints. Either Excel refuses a well-posed combinatorial question, or the documented constraint is stricter than the implementation. The Handbook has not checked which, and it is the first probe listed below.

Arguments

ArgumentMeaningConstraint (as documented)
number (N)The number of item types available. Required.≥ 0, and ≥ number_chosen
number_chosen (M)The number of items chosen. Required.≥ 0

Microsoft states that non-integer values are truncated in both positions, and that a non-numeric value in either position gives #VALUE!.

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

Result and edge cases

Returns Number, mathematically always a positive integer.

  • k = 0 — one way to choose nothing: the value is 1.
  • n = 0 — the printed equation reads (M-1)!/(M!(-1)!), which is undefined for M > 0; the documented constraint N ≥ M forces M = 0 there, and COMBINA(0, 0) is conventionally
    1. What Excel actually returns at (0, 0) is a documented-constraint boundary the Handbook has not checked.
  • Growth — COMBINA(n, k) is C(n+k-1, k), so it crosses the 2^53 exact-integer threshold at modest arguments and overflows the double range not far beyond.
  • A returned value that is not an integer is itself a finding. Every value of this function is an integer, so a fractional result cannot come from the mathematics. EV-MATH-0017 turns exactly this observation into a substrate identification (below).

The real-result policy axis records arg_domain_guard=none; non_finite=allow for this surface, which — as on COMBIN — sits uneasily beside a documented #NUM! domain condition. Recorded here as a divergence, not resolved.

Errors

As documented on Microsoft's COMBINA page:

ErrorCondition
#NUM!The value of either argument is outside its documented constraints
#VALUE!Either argument is a non-numeric value

Note that the documented #NUM! condition is stated indirectly — "outside of its constraints" — so the exact trigger set is only as precise as the constraint list above it, and that list includes the N ≥ M requirement this page flags as mathematically unnecessary.

How to implement

Numerical notes

The interesting fact about this surface is that its evaluation route has been identified, and identified by a single decisive witness rather than by a sweep.

The reasoning is worth stating because it is a model of how substrate identification works. COMBINA(n, k) is always an integer. A product of integers, evaluated in binary64, can round — but it can only land on a representable neighbour of the true value, and while the true value is below 2^53 the exact integer is representable, so a product route hits it. EV-MATH-0017 records a live witness in which Excel returns a value just below an exact integer that a product route would have reached exactly. A product cannot produce that. An exp(lnΓ) composition can: the logarithm loses the integrality, and the final exponentiation lands on whichever neighbour the rounding chain reaches. The record therefore identifies the substrate as exp(gammaln) and reduces COMBINA to the log-gamma wall — meaning its residual error is not its own problem to solve but GAMMALN's.

Two honest riders travel with that, both from the record itself: the reference implementation does not implement the identified substrate — it ships a product kernel — and the formal reduction to GAMMALN is a designed recipe that has not been executed.

What a careful implementation does when it wants the intended function rather than the observed bits:

  1. Reduce to a binomial coefficient first: C(n+k-1, k), then apply the symmetry reduction k ← min(k, n-1). Never form the three factorials of the printed equation — (N+M-1)! overflows at an argument sum of 171 while the answer may still be small.
  2. Use the multiplicative recurrence acc ← acc·(n-1+i)/i, whose every partial product is itself a binomial coefficient and therefore an exact integer while it fits.
  3. Return the exact integer below 2^53. This is achievable and is the property the exp(lnΓ) route gives up.
  4. Above 2^53, the log-gamma route becomes attractive for range reasons and immediately inherits log-gamma's accuracy: an absolute error ε in lnΓ becomes a relative error of about ε in the result, and lnΓ of a large argument is large, so a small relative error in the logarithm is a much larger relative error in the answer. That amplification is the wall the record names, and it is the standard reason (A&S chapter 6; Numerical Recipes bico) that libraries which use exp(factln) document reduced accuracy for large binomials.

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.

COMBINA · 3 lines · calc-func/src/catalogue/math.rs on GitHub
35 combina "COMBINA" (2, 2) [V "number", V "number_chosen"] |s, a, sv| {
    out(s, k::combina::combina_kernel(num_with_subnormal(s, a, 0)?, num_with_subnormal(s, a, 1)?))
}
combina_kernel · 42 lines · calc-func/src/ported/combina.rs on GitHub
pub fn combina_kernel(n: f64, k: f64) -> Result<f64, WorksheetErrorCode> {
    // Range.Value2 cannot inject NaN/infinity into the live worksheet probe,
    // but the direct Rust kernel keeps that unobserved seam deterministic.
    if !n.is_finite() || !k.is_finite() {
        return Err(WorksheetErrorCode::Num);
    }

    // The current x64 reference treats binary64 subnormals as signed zero at
    // this admission seam (DAZ). Truncation then precedes the asymmetric
    // negative-choice guard.
    let n = if n.is_subnormal() {
        0.0_f64.copysign(n)
    } else {
        n
    };
    let k = if k.is_subnormal() {
        0.0_f64.copysign(k)
    } else {
        k
    };
    let truncated_n = n.trunc();
    let truncated_k = k.trunc();

    // This zero/zero publication precedes the negative-choice guard. Thus
    // values in (-1,0), including a negative raw choice, publish one when both
    // arguments truncate to zero.
    if truncated_n == 0.0 && truncated_k == 0.0 {
        return Ok(1.0);
    }
    if truncated_n < 0.0 || k < 0.0 {
        return Err(WorksheetErrorCode::Num);
    }

    let total = truncated_n + truncated_k - 1.0;

    // W109 current-reference identification: COMBINA truncates its two
    // arguments separately, then routes C(n+k-1,k) through the same cyclic
    // stored-x87 publication graph as COMBIN. In particular, this is not the
    // worksheet-visible composition COMBIN(n+k-1,k), whose addition would
    // occur before COMBIN truncates fractional arguments.
    combin_kernel(total, truncated_k)
}

Kernels shared with other functions

Argument and result plumbing

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
19929Windows, bitness not recorded, CPU not recorded144
20228Windows, 64-bit, CPU not recorded39,773
20430Windows, 64-bit, CPU not recorded1,242
  • XC-COMBINA-001: build 19929 versus build 20228; 126 same-input pairs, 0 differing answers. Compared axes: excel-build. Numeric answers were compared by their recorded binary64 bits; other answers by typed value.
  • XC-COMBINA-002: build 19929 versus build 20430; 2 same-input pairs, 0 differing answers. Compared axes: excel-build. Numeric answers were compared by their recorded binary64 bits; other answers by typed value.
  • XC-COMBINA-003: build 20228 versus build 20430; 24 same-input pairs, 0 differing answers. Compared axes: excel-build. Numeric answers were compared by their recorded binary64 bits; other answers by typed value.

Agreement on these compared inputs does not establish agreement on unmeasured inputs.

Recorded environments and comparison details.

Excel 16.0 build 19929

Windows, bitness not recorded, CPU not recorded

144 captured inputs are indexed for this environment. Capture dates are not recorded. This is a reading count, not a comparison with another build.

Excel 16.0 build 20228

Windows, 64-bit, CPU not recorded

39,773 captured inputs are indexed for this environment. Capture dates: 2026-08-09 to 2026-08-09. This is a reading count, not a comparison with another build.

Excel 16.0 build 20430

Windows, 64-bit, CPU not recorded

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

Alternatives

Relationships

  • COMBIN — the without-repetition count. The bridge identity COMBINA(n, k) = COMBIN(n+k-1, k) means the two surfaces must agree on the same integer when their arguments are matched up. They have different identified substrates, so that identity is a metamorphic test rather than a tautology.
  • PERMUTATIONA — with-repetition and ordered: simply n^k. PERMUT is the ordered without-repetition count. The four functions form the standard 2×2 of ordered/unordered against with/without repetition.
  • GAMMALN, GAMMALN.PRECISE, EXP — the identified substrate composition. EV-MATH-0017 reduces this surface's remaining error to the log-gamma surface's, which is why the two pages should be read together.
  • NEGBINOM.DIST — the distribution whose mass function is exactly a multiset coefficient times probabilities; the same evaluation problem appears there with a stability requirement.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents