HYPGEOM.DIST Function (LibreOffice Calc)
Learn the HYPGEOM.DIST function in LibreOffice Calc: Values of the hypergeometric distribution.
Verification status: Saved LibreOffice Calc 25.2.3.2 observations and supplementary LibreOfficeDev 26.8.0.0.alpha0 XLSX results were reviewed for the identified examples. The historical stable installation was not rerun; the guide distinguishes those evidence sets. How formula examples are checked
Availability and version history
- Introduced: LibreOffice 4.2, explicitly stated in official HYPGEOM.DIST Help.
- Availability: Supported in LibreOffice 26.8.1.1, confirmed by the versioned function registry. This is not a final supported version.
- Scope: Desktop Calc; formula names and separators depend on language/settings. Other spreadsheet products need separate compatibility checks.
- Checked: October 14, 2026. Documentation/source evidence; saved 25.2.3.2 native observations and supplementary development-build XLSX tests are scoped separately below.
Validation scope: The saved native observations in this guide were produced in LibreOffice Calc 25.2.3.2 on Linux on October 13, 2026. This revision verified the corresponding saved ODS values against the result ledgers; it did not rerun that historical installation. Supplementary numerical cases were recalculated through imported XLSX files in LibreOfficeDev 26.8.0.0.alpha0 (build 2c87e51eeaa2b413ff4ae097b2705eea1995d8e5). That development-build/import check is separate from direct formula entry and from the stable-release support evidence.
Quick answer
HYPGEOM.DIST calculates the probability of observing a particular number of successes when you take a fixed-size random sample without replacement from a finite population. Use the fifth argument to select the probability of exactly that many successes (FALSE() / 0) or at most that many (TRUE() / nonzero). It is a discrete distribution: the point probability is a probability mass, even though the official Help informally calls it a “probability density.” official function Help
=HYPGEOM.DIST(2;5;7;20;FALSE())
Native-tested result: 0.387383900928793, or about 38.74%. Interpretation: exactly two of the five items sampled are successes, when seven of the twenty available items are successes.
For at most two successes:
=HYPGEOM.DIST(2;5;7;20;TRUE())
Native-tested result: 0.793214654282766, about 79.32%. The cumulative result adds the probabilities for zero, one and two successes.
Exact syntax, required arguments and constraints
=HYPGEOM.DIST(X; NSample; Successes; NPopulation; Cumulative)
| Argument | Required | Description | Example |
|---|---|---|---|
X |
Yes | Number of observed successes in the sample | 2 |
NSample |
Yes | Number of items sampled, n |
5 |
Successes |
Yes | Total successful items in the population, K |
7 |
NPopulation |
Yes | Number of total population items, N |
20 |
Cumulative |
Yes | FALSE()/0 means exact probability; TRUE() or another nonzero number means cumulative probability |
FALSE() |
All five arguments are required by the documented modern function. In contrast, the separate legacy HYPGEOMDIST spelling documents the fifth argument as optional, defaulting to the exact probability. On native Calc 25.2.3.2, omitting the fifth parameter from HYPGEOM.DIST returned Err:511. official function Help
The meaningful combinatorial model assumes whole-number counts: N ≥ 0, 0 ≤ K ≤ N, 0 ≤ n ≤ N, and 0 ≤ X ≤ n. For a feasible exact outcome, also require max(0,n-(N-K)) ≤ X ≤ min(n,K). Outcomes outside the feasible support cannot occur. The function’s handling of invalid inputs is version-specific and should not replace model validation.
This guide uses the English Calc names, a decimal point, and a semicolon argument separator as tested. Localized installations may use translated function names or adjusted separators. Refer to Calc’s Formula options. OpenFormula standard
Reproduce the official example
LibreOffice Help uses a population of 100 items, 90 of which are successes, and a sample of two items. official function Help
=HYPGEOM.DIST(2;2;90;100;0)
Native-tested result: 0.809090909090909 (about 80.91%). This is the probability that both selected items are from the 90 successes when drawing two items without replacement. The result can be independently checked as (90/100) × (89/99). official function Help
=HYPGEOM.DIST(2;2;90;100;1)
Native-tested result: 1. A sample of size two cannot contain more than two successes, so the probability of at most two successes is 100%.
Build a complete probability table
Imagine a quality inspector selecting 5 components at random, without replacement, from a box of 20, of which 7 have a particular characteristic. All values below were independently computed with integer combinations and then confirmed by native Calc formulas.
X successes |
Formula ending in ;FALSE()) (exact X) |
Probability of exactly X |
Probability of at most X (;TRUE())) |
|---|---|---|---|
| 0 | =HYPGEOM.DIST(0;5;7;20;FALSE()) |
0.0830108359 |
0.0830108359 |
| 1 | =HYPGEOM.DIST(1;5;7;20;FALSE()) |
0.3228199174 |
0.4058307534 |
| 2 | =HYPGEOM.DIST(2;5;7;20;FALSE()) |
0.3873839009 |
0.7932146543 |
| 3 | =HYPGEOM.DIST(3;5;7;20;FALSE()) |
0.1760835913 |
0.9692982456 |
| 4 | =HYPGEOM.DIST(4;5;7;20;FALSE()) |
0.0293472652 |
0.9986455108 |
| 5 | =HYPGEOM.DIST(5;5;7;20;FALSE()) |
0.0013544892 |
1.0000000000 |
To reproduce this in cells, put the integers 0 to 5 in A2:A7, and enter 5 in B1, 7 in C1, and 20 in D1. In B2, enter =HYPGEOM.DIST(A2;$B$1;$C$1;$D$1;FALSE()); in C2, enter =HYPGEOM.DIST(A2;$B$1;$C$1;$D$1;TRUE()). Copy these two formulas through row 7. The rows are a reproducible spreadsheet construction based on the individually native-tested equivalent literal formulas; the relative/absolute-copy operation itself was not separately tested here.
The exact-probability column sums to 1 (within normal floating-point rounding). The cumulative column is nondecreasing and reaches 1 at the largest possible success count. If either statement fails for your model, check the population/sample arguments or the formulas.
Advanced probability calculations
Probability of at least three successes
“At least three” is the complement of “at most two,” so calculate 1 - P(X ≤ 2):
=1-HYPGEOM.DIST(2;5;7;20;TRUE())
Native-tested result: 0.206785345717234 (about 20.68%). This is not HYPGEOM.DIST(3;…;FALSE()), which would count only exactly three successes. For extremely small tail probabilities, subtracting a cumulative result close to 1 can lose precision; evaluate numerical stability for the actual problem before treating a displayed zero as mathematical impossibility.
Probability between two and four successes, inclusive
Use the difference of cumulative probabilities P(X≤4) - P(X≤1):
=HYPGEOM.DIST(4;5;7;20;TRUE())-HYPGEOM.DIST(1;5;7;20;TRUE())
Native-tested result: 0.59281475748194 (approximately 59.28%). The endpoints are correct because subtracting the cumulative probability through 1 removes every event below 2.
Verify with combinations
The probability-mass formula is
P(X=x) = COMBIN(K;x) × COMBIN(N-K;n-x) / COMBIN(N;n)
for an outcome within the feasible support. Use K=7, N=20, n=5, x=2:
=COMBIN(7;2)*COMBIN(13;3)/COMBIN(20;5)
Native-tested result: 0.387383900928793, matching HYPGEOM.DIST(2;5;7;20;FALSE()). The identity arises because COMBIN(7;2) chooses two successes, COMBIN(13;3) chooses three failures, and COMBIN(20;5) counts all possible samples of size five.
Validate inputs explicitly
One native-tested example with fixed inputs is:
=IF(OR(2<0;5>20;7>20);NA();HYPGEOM.DIST(2;5;7;20;FALSE()))
It returned 0.387383900928793. The example illustrates guarding the three named invalid conditions before evaluation; it is not a complete universal guard. For a reusable model, additionally verify that the cells contain numbers, all count arguments are whole numbers, 0 ≤ X ≤ NSample, and the sample and success totals are each no greater than NPopulation. For instance, INT(A2)=A2 can help check integer inputs, but its combined error behavior must be tested with your data types before using it in an automated workflow.
Important statistical interpretation
Without replacement matters. After one item is drawn, the number of remaining items changes. A binomial model assumes independent trials with a constant probability; a hypergeometric model applies to a fixed population with draws without replacement. An expected value for this model is n×K/N; for the quality-inspection case that is 5×7/20 = 1.75 successes. An expected value is an average over repeated sampling and need not be one of the integer outcomes of a single sample.
Mass versus cumulative probability: HYPGEOM.DIST(2;5;7;20;FALSE()) asks for exactly two, while the TRUE() version asks for at most two. These are different questions, and confusing them produces incorrect risk estimates. official function Help
Boundary conditions: Native calculations returned 1 for HYPGEOM.DIST(0;1;0;10;FALSE()), for sampling five out of twenty all-success items, and for drawing no items with exactly zero successes. Those results follow logically from the combinatorial experiment. They should not be generalized to impossible negative-count inputs.
Errors, edge cases and troubleshooting
| Formula or situation | Calc 25.2.3.2 observation | What to do |
|---|---|---|
Four arguments, missing Cumulative |
Err:511 |
Provide fifth argument. |
=HYPGEOM.DIST(-1;5;7;20;FALSE()) |
Err:502 |
Success count cannot be negative; fix source data. |
| Sample 11, population 10 | Err:502 |
The sample must not exceed the population. |
| Successes 11, population 10 | Err:502 |
The population success total must not exceed the population size. |
| Negative population | Err:502 |
Validate nonnegative population counts. |
=HYPGEOM.DIST(2.9;5;7;20;FALSE()) |
0.387383900928793 |
Fractional X truncated to 2 in the tested build. Reject or explicitly normalize fractional counts in your model. |
=HYPGEOM.DIST(2;5.7;7;20;FALSE()) |
0.387383900928793 |
Fractional sample size truncated to 5 in the tested build. Do not interpret this as a fractional-item model. |
=HYPGEOM.DIST(2;5;7;20;2) |
0.793214654282766 |
A nonzero fifth argument selected the cumulative result in the tested build. Prefer explicit TRUE() or FALSE(). |
These are native observations, not promises of the exact error message on every OS, locale, edition or version. The official Help describes the arguments and mode flag; the tests establish these additional specific Calc 25.2.3.2 behaviors. official function Help
Compatibility, legacy name and OpenFormula scope
The official LibreOffice Help documents HYPGEOM.DIST as available since LibreOffice 4.2 and associates it with the compatibility namespace COM.MICROSOFT.HYPGEOM.DIST; it is not part of OpenDocument 1.3 OpenFormula as a standard name. Users type HYPGEOM.DIST in a normally configured English-language Calc formula, not the namespace string. official function Help
HYPGEOMDIST is a separately documented legacy spelling with an optional fifth argument. The official Help marks its fifth cumulative flag as optional, with FALSE/exact probability as default. Native tests confirmed =HYPGEOMDIST(2;5;7;20) returned 0.387383900928793 and =HYPGEOMDIST(2;5;7;20;TRUE()) returned 0.793214654282766. This is a narrow comparison of equivalent valid integer examples, not a guarantee that all invalid-input, spreadsheet-import or version behaviors are interchangeable. official function Help
The saved validation workbook was saved and reopened in the tested native Calc build; the saved 25.2.3.2 tests used direct formula entry, without XLSX import or Excel execution, and independent calculations are not a substitute for native application testing.
Related LibreOffice tutorials
- HYPGEOMDIST — legacy name; optional cumulative flag.
- COMBIN — counts unordered combinations, used in the PMF formula.
- BINOM.DIST — binomial distribution for a different sampling model.
- POISSON.DIST — another discrete count distribution with different assumptions.