Contact

HYPGEOM.DIST in ONLYOFFICE Spreadsheet Editor

Statistical Intermediate ONLYOFFICE Spreadsheet Editor

Calculate hypergeometric exact-count and cumulative probabilities for sampling without replacement, with integer support, small combinatorial proofs and legacy differences.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

Quick answer: =HYPGEOM.DIST(1,3,4,10,FALSE) has independent expectation 0.5. TRUE instead gives 2/3 ≈ 0.666666666667, the probability of at most one success.

Availability and evidence scope

  • Introduced: Original introduction release is not established by the checked sources.
  • Available: Listed in current unversioned ONLYOFFICE help, checked October 18, 2026.
  • Implementation inspected: Official SDKJS v10.0.0.169, commit 3679e0375a758d7dc59d31337a45461be3525ed8. The snapshot does not prove identical behavior in every installed editor.
  • Retired or deprecated: These sources do not establish retirement or formal deprecation. A legacy name alone does not mean the function has been removed.
  • Testing: Numerical examples are independent mathematical expectations, and implementation discrepancies are labeled source predictions. No ONLYOFFICE application or calculation-engine execution was performed.

The examples use English function names and commas. Use your locale’s argument separator if different. Retain full precision in formulas; round only the displayed result. The examples describe function mechanics under the stated model, rather than establishing that your observations follow that model.

Syntax and sampling model

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

All five arguments are required. Write them as k, n, M and N when checking the model: k is the observed success count, n is the number drawn, M is the number of successes in the population and N is total population size. TRUE returns P(X≤k); FALSE returns the probability mass P(X=k). This is a discrete mass, not a continuous density.

The model assumes a simple random sample of n items without replacement from a fixed population. Each item is classified as success or failure. The success label is arbitrary; it could mean a selected color or category. With replacement, the draws follow a different model and these formulas do not apply unchanged.

The mathematical support is from MAX(0,n-(N-M)) through MIN(n,M). It is impossible to select more successes than either the sample or population contains, and a sample large enough to exhaust failures must contain some successes.

Step-by-step: draw three from ten labeled items

Suppose a population has 10 items, of which 4 are blue. Draw 3 without replacement. Let X be the number of blue items.

  1. Put sample size 3 in B1, blue population count 4 in B2 and total population 10 in B3.
  2. Put candidate counts 0, 1, 2 and 3 in A6:A9.
  3. In B6 enter =HYPGEOM.DIST(A6,$B$1,$B$2,$B$3,FALSE) and copy down.
  4. In C6 enter =HYPGEOM.DIST(A6,$B$1,$B$2,$B$3,TRUE) and copy down.
Blue items k Independent exact mass Independent cumulative probability
0 1/6 1/6
1 1/2 2/3
2 3/10 29/30
3 1/30 1

There are COMBIN(10,3)=120 equally likely unordered samples. Exactly one blue can be chosen in COMBIN(4,1)*COMBIN(6,2)=60 ways, so its probability is 60/120 = 0.5. Exactly zero has 20 possibilities, exactly two has 36, and exactly three has 4. The counts sum to 120, and their probabilities sum to 1.

Advanced example: at least two successes

“At least two” means P(X≥2), so use =1-HYPGEOM.DIST(1,3,4,10,TRUE), independently 1/3. Subtracting the CDF at 2 would instead give P(X>2) = P(X=3) = 1/30. The one-count shift is important because the distribution is discrete.

A second check is to add the masses for 2 and 3, giving 3/10+1/30 = 1/3. If the selected category is swapped from blue to nonblue, successes in the sample become 3-X; probabilities should be translated with that change in variable, rather than merely changing population_s and leaving the requested event unchanged.

For a large population and small sample, another model may approximate sampling without replacement, but approximation is not built into the meaning of these inputs. The inspected CDF sums masses over support; large-count work should be assessed separately for performance and numerical precision.

Integer conversion, boundaries and errors

The inspected wrapper floors all four count arguments before validating them. For positive inputs, =HYPGEOM.DIST(1.9,3.9,4.9,10.9,FALSE) therefore reduces to the example with 1, 3, 4 and 10. Supply integers deliberately instead of relying on silent rounding; a fraction of an item is not a meaningful population count.

Negative floored counts, sample size greater than population size, or population successes greater than population size predict internal not_numeric (#NUM!). Counts above 2,147,483,647 are also rejected. This accepted numeric bound is not a practical performance recommendation.

For otherwise valid nonnegative counts, the helper returns mass 0 when k is outside the feasible support; its CDF returns 0 below support and 1 at or above the upper support. Thus k = 4 in this example gives mass 0, rather than a domain error. Negative k is rejected earlier. Current help describes stricter positive/interior bounds; the source has these explicit boundary behaviors.

Legacy HYPGEOMDIST is a separate four-argument, mass-only implementation in the inspected snapshot. Its current help incorrectly shows a cumulative parameter relative to that source registration. Use the dotted function when you need a cumulative flag; do not assume the legacy name accepts a fifth argument.

Recalculate representative formulas when moving a workbook between editors. Matching names do not guarantee identical argument coercion, array behavior, numerical precision or error handling. The scalar formulas here do not establish automatic spill behavior or a general import/export guarantee.

Official references