Statistical functions

HYPGEOM.DIST

Known larger differences on 208 of 3,759 recorded answers

Of 3,759 recorded answers (3,661 in the answer bank and 98 workbook cells), 208 do not match: 4 differ by more than 16 ULP, 204 differ by at most 16 ULP. How we measure this · See the Rust code

Local names in 40 languages
LanguageName in Excel
ArabicHYPGEOM.DIST
BulgarianHYPGEOM.DIST
CzechHYPGEOM.DIST
DanishHYPGEO.FORDELING
GermanHYPGEOM.DIST
GreekHYPGEOM.DIST
English (Australia)HYPGEOM.DIST
English (United Kingdom)HYPGEOM.DIST
English (United States)HYPGEOM.DIST
SpanishDISTR.HIPERGEOM.N
EstonianHYPGEOM.DIST
FinnishHYPERGEOM_JAKAUMA
FrenchLOI.HYPERGEOMETRIQUE.N
HebrewHYPGEOM.DIST
CroatianHYPGEOM.DIST
HungarianHIPGEOM.ELOSZLÁS
IndonesianHYPGEOM.DIST
ItalianHYPGEOM.DIST
JapaneseHYPGEOM_DIST
KoreanHYPGEOM. DIST
LithuanianHYPGEOM.DIST
LatvianHYPGEOM.DIST
NorwegianHYPGEOM.FORDELING.N
DutchHYPGEOM.VERD
PolishROZKŁ.HIPERGEOM
Portuguese (Brazil)HYPGEOM.DIST
Portuguese (Portugal)DIST.HIPGEOM
RomanianHYPGEOM.DIST
RussianГИПЕРГЕОМ.РАСП
SlovakHYPGEOM.DIST
SlovenianHYPGEOM. DIST
Serbian (Latin)HYPGEOM.DIST
SwedishHYPGEOM.FÖRD
ThaiHYPGEOM.DIST
TurkishHİPERGEOM.DAĞ işlevi
UkrainianHYPGEOM.DIST
VietnameseHYPGEOM.DIST
Chinese (Simplified)HYPGEOM.DIST
Chinese (Hong Kong)HYPGEOM.DIST
Chinese (Traditional)HYPGEOM.DIST

Names from Microsoft's support site.

What it does

HYPGEOM.DIST(sample_s, number_sample, population_s, number_pop, cumulative)

HYPGEOM.DIST(sample_s, number_sample, population_s, number_pop, cumulative) models a fixed-size sample drawn without replacement from a finite population. Every subset of the sample size has equal probability. FALSE returns the mass at exactly sample_s successes; TRUE returns the probability of at most that many.

Write the four counts as k,n,K,N: observed successes, sample size, population successes and population size. The success probability changes after each draw because the selected object is not replaced. A binomial model with one fixed probability answers a different sampling question.

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.

=HYPGEOM.DIST(1,2,3,5,FALSE) is about 0.6. Drawing two objects from five, three marked successful, yields one success in choose(3,1)*choose(2,1)=6 of choose(5,2)=10 possible samples.

Quirks

The feasible mathematical success interval is max(0,n-(N-K))..min(n,K). Microsoft’s opened remarks specify #NUM! outside that interval and for nonpositive sample size, population success count or population size. Nonnumeric count arguments give #VALUE!.

Recorded build 20430 controls depart from those stated guards. HYPGEOM.DIST(0,0,0,5,0) returned one. With successes above the support, HYPGEOM.DIST(5,4,2,5,0) returned zero, while changing the cumulative flag from zero to one returned one. FN-HYPGEOM.DIST-001 retains all four calls, exact inputs and provenance.

The current code checks original negative signs before truncating the counts, so a negative fraction must not become an admitted zero merely through truncation. Its support shortcuts and mass body need separate tests; neither the probability definition nor the public error list settles every recorded numerical edge.

Recorded hypergeometric calls admit zero counts and counts above the support

Four retained build 20430 controls return numeric values where the opened documentation specifies #NUM!: HYPGEOM.DIST(0,0,0,5,0) and its cumulative form both return 1; HYPGEOM.DIST(5,4,2,5,0) returns 0 and its cumulative form returns 1. These observations cover the listed inputs, not every out-of-support call.

FormulaExcelMathematical value
HYPGEOM.DIST(0,0,0,5,0)
Excel 16.0 build 20430, Windows 64-bit (NT 10.00), Workbook Compatibility Version 2; CPU not recorded. Captured 29 September 2026.
Inputs and reference value

Number supplied through a cell.

sample_s: 0
0x0000000000000000

number_sample: 0
0x0000000000000000

population_s: 0
0x0000000000000000

number_pop: 5
0x4014000000000000

cumulative: 0
0x0000000000000000

1
0x3ff0000000000000
—
HYPGEOM.DIST(0,0,0,5,1)
Excel 16.0 build 20430, Windows 64-bit (NT 10.00), Workbook Compatibility Version 2; CPU not recorded. Captured 29 September 2026.
Inputs and reference value

Number supplied through a cell.

sample_s: 0
0x0000000000000000

number_sample: 0
0x0000000000000000

population_s: 0
0x0000000000000000

number_pop: 5
0x4014000000000000

cumulative: 1
0x3ff0000000000000

1
0x3ff0000000000000
—
HYPGEOM.DIST(5,4,2,5,0)
Excel 16.0 build 20430, Windows 64-bit (NT 10.00), Workbook Compatibility Version 2; CPU not recorded. Captured 29 September 2026.
Inputs and reference value

Number supplied through a cell.

sample_s: 5
0x4014000000000000

number_sample: 4
0x4010000000000000

population_s: 2
0x4000000000000000

number_pop: 5
0x4014000000000000

cumulative: 0
0x0000000000000000

0
0x0000000000000000
—
HYPGEOM.DIST(5,4,2,5,1)
Excel 16.0 build 20430, Windows 64-bit (NT 10.00), Workbook Compatibility Version 2; CPU not recorded. Captured 29 September 2026.
Inputs and reference value

Number supplied through a cell.

sample_s: 5
0x4014000000000000

number_sample: 4
0x4010000000000000

population_s: 2
0x4000000000000000

number_pop: 5
0x4014000000000000

cumulative: 1
0x3ff0000000000000

1
0x3ff0000000000000
—

Inputs, build details and evidence

How to implement

For a mathematical implementation, count the supported selections:

mass(k) = choose(K,k) * choose(N-K,n-k) / choose(N,n)

The sample k=1,n=2,K=3,N=5 has six favourable subsets out of ten, giving probability 0.6. A recurrence between adjacent supported masses is a way to avoid constructing huge factorials, but it is an alternative algorithm.

The current compatibility candidate has a more specific composition:

  1. Reject original negative counts, then truncate all four toward zero. Reject n>N or K>N.
  2. For a mass, return zero for an unsupported k. Handle the degenerate n=0 and n=N cases explicitly.
  3. Otherwise form the binary64 values p=n/N and q=(N-n)/N separately. Do not assume the stored q is interchangeable with 1-p.
  4. Obtain shared binomial masses a=b(k;K,p,q), b=b(n-k;N-K,p,q) and c=b(n;N,p,q). Return (a*b)/c using the current binary64 multiplication and division order.
  5. For cumulative calls, the current code returns one immediately when k>=min(n,K); otherwise it adds masses from zero through k and caps the sum at one.

The shared binomial body, small-tail choices and publication behaviour retain unresolved differences in the problem report. The generated fingerprint report says no complete hypergeometric algorithm is adopted. Treat this as a codeable current candidate, with the named recorded endpoint controls, rather than a whole-domain Excel identification.

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.

HYPGEOM.DIST · 4 lines · calc-func/src/catalogue/distributions.rs on GitHub
77 hypgeom_dist "HYPGEOM.DIST" (5, 5) [V "sample_s", V "number_sample", V "population_s", V "number_pop", V "cumulative"] |s, a, sv| {
    let [ss, ns, ps, np] = nums::<4>(s, a)?;
    out(s, dd::hypergeom_dist_kernel(ss, ns, ps, np, flag(s, a, 4)?))
}

Kernels shared with other functions

Argument and result plumbing

  • flag catalogue/kit
  • num catalogue/kit
  • out 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
20430Windows, 64-bit, CPU not recorded3,653

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.

Concrete controls from the 29 September 2026 build 20430 capture:

Captured callExcel result
HYPGEOM.DIST(0,0,0,5,0)1
HYPGEOM.DIST(0,0,0,5,1)1
HYPGEOM.DIST(5,4,2,5,0)0
HYPGEOM.DIST(5,4,2,5,1)1

Inputs were written as exact doubles through bulk Value2 cells. The capture records Windows 64-bit and Compatibility Version 2; it does not record CPU. These controls do not compare builds.

Recorded environments and comparison details.

Excel 16.0 build 20430

Windows, 64-bit, CPU not recorded

Recorded zero-count calls returned 1, and the sampled above-support call returned mass 0 and CDF 1. Four exact controls are attached from build 20430; no cross-build comparison was made.

Observed formulas and results
  • HYPGEOM.DIST(0,0,0,5,0) → 1
    0x3ff0000000000000 (cell-value2)
  • HYPGEOM.DIST(0,0,0,5,1) → 1
    0x3ff0000000000000 (cell-value2)
  • HYPGEOM.DIST(5,4,2,5,0) → 0
    0x0000000000000000 (cell-value2)
  • HYPGEOM.DIST(5,4,2,5,1) → 1
    0x3ff0000000000000 (cell-value2)

Alternatives

HYPGEOMDIST is the mass-only compatibility spelling. BINOM.DIST describes independent trials with one fixed probability, and COMBIN counts selections.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents