HYPGEOMDIST Function (LibreOffice Calc)
LibreOffice HYPGEOMDIST calculates sampling probabilities without replacement, with optional cumulative mode and explicit feasible-support checks.
Verification status: Official release source and independently calculated examples for HYPGEOMDIST were reviewed. No new LibreOffice Calc application execution is claimed for this guide; the stated version and example limits still apply. How formula examples are checked
Quick answer: =HYPGEOMDIST(2;5;7;20) gives approximately 0.387383900929. It is the chance of exactly two successes when drawing five items without replacement from twenty items containing seven successes.
Availability and version history
- Introduced: First release not established. The LibreOffice 3.3 function appendix documents this name; historical presence does not prove introduction.
- Supported in: LibreOffice 26.8.1.1. No final supported release has been established.
- Scope: Desktop Calc. Current argument defaults are stated for the cited release, not inferred for every older version.
- Checked: October 14, 2026. Official documentation/source and independent mathematics checked; LibreOffice Calc was not run for this guide.
Sampling without replacement
The hypergeometric model describes a finite population. Each selected item is removed before the next draw, so the success probability changes as sampling proceeds. That differs from a binomial model with independent trials and a constant success probability. Official reference.
For x successes in n draws, M successful items in a population of N, the probability mass is COMBIN(M;x)×COMBIN(N−M;n−x)/COMBIN(N;n). This is a discrete probability mass, not a continuous density. Exact integer counts determine the combinations.
Syntax and arguments
=HYPGEOMDIST(X; NSample; Successes; NPopulation [; Cumulative])
The first four inputs are counts. Use nonnegative integers, with 0≤Successes≤NPopulation and 0≤NSample≤NPopulation. The feasible success count lies between MAX(0;NSample−(NPopulation−Successes)) and MIN(NSample;Successes).
LibreOffice accepts an optional fifth argument: omitted or 0 means exactly X successes; 1 means at most X successes. The dotted HYPGEOM.DIST function instead requires that fifth argument. The versioned evaluator establishes this contract.
Reproducible reference cases
The first six rows enumerate the possible success counts for n=5, M=7, N=20. Each input is an integer. Expected values are independently calculated and rounded to twelve decimal places.
| Formula | Expected result, approximately |
|---|---|
=HYPGEOMDIST(0;5;7;20) |
0.083010835913 |
=HYPGEOMDIST(1;5;7;20) |
0.322819917441 |
=HYPGEOMDIST(2;5;7;20) |
0.387383900929 |
=HYPGEOMDIST(3;5;7;20) |
0.176083591331 |
=HYPGEOMDIST(4;5;7;20) |
0.029347265222 |
=HYPGEOMDIST(5;5;7;20) |
0.001354489164 |
=HYPGEOMDIST(0;5;0;20) |
1 |
=HYPGEOMDIST(5;5;20;20) |
1 |
=HYPGEOMDIST(2;5;7;20;1) |
0.793214654283 |
=HYPGEOMDIST(2;5;7;20;0) |
0.387383900929 |
Practical worksheet: inspect a fixed lot
Suppose a lot contains twenty items, seven of a specified type, and five items are sampled uniformly without replacement. Put 2, 5, 7 and 20 in A2:D2. In E2 use =HYPGEOMDIST(A2;B2;C2;D2), expected 0.387383900929.
This model assumes the population composition is known and every size-five subset is equally likely. Sampling with replacement, biased selection or an uncertain success count changes the model. The formula cannot determine those assumptions from four numbers.
Advanced example: at most two successes
Use =HYPGEOMDIST(2;5;7;20;1) to sum the masses for 0, 1 and 2 successes. The expected cumulative probability is approximately 0.793214654283. The probability of at least three successes is its complement, approximately 0.206785345717.
For a general table, put integer counts 0 through 5 in A5:A10 and enter =HYPGEOMDIST(A5;5;7;20) in B5, filling down. =SUM(B5:B10) should be approximately 1. This is a full-support check, not a rule that every arbitrary interval of counts sums to 1.
Feasible support and release differences
The release floors count inputs before its checks, but fractional counts are not meaningful sample sizes. Validate them as integers rather than relying on truncation to repair the data.
For otherwise valid population/sample inputs, this release can return zero when X is outside the feasible success support but still passes its argument guards. For example X=2, sample=5, successes=1, population=20 has zero mass. Other invalid combinations, such as X greater than the sample size, are rejected.
A cumulative request still follows the function’s argument guards; do not assume every X beyond the sample size is automatically accepted as probability 1.
Errors and interpretation
Keep population successes distinct from observed sample successes. Swapping them may still produce an answer while describing another experiment. Compare the six-row probability table and check the full sum before adapting the model.
These reference values do not establish native behavior for every large count, Boolean, text value or imported workbook. A zero mass, an invalid parameter error and an untested extreme calculation are different outcomes and should not be silently replaced with one another.