# WorksheetFunction.HypGeom_Dist (Excel)

Returns the hypergeometric distribution. HypGeom_Dist returns the probability of a given number of sample successes, given the sample size, population successes, and population size. Use HypGeom_Dist for problems with a finite population, where each observation is either a success or a failure, and where each subset of a given size is chosen with equal likelihood.

All arguments are truncated to integers. If any argument is nonnumeric, HypGeom_Dist returns the #VALUE! error value. If sample_s < 0 or sample_s is greater than the lesser of number_sample or population_s, HypGeom_Dist returns the #NUM! error value. If sample_s is less than the larger of 0 or (number_sample - number_population + population_s), HypGeom_Dist returns the #NUM! error value. If number_sample ≤ 0 or number_sample > number_population, HypGeom_Dist returns the #NUM! error value. If population_s ≤ 0 or population_s > number_population, HypGeom_Dist returns the #NUM! error value. If number_population ≤ 0, HypGeom_Dist returns the #NUM! error value. The equation for the hypergeometric distribution is as follows, where:

**HypGeom_Dist** (Arg1, Arg2, ..., Arg5)

```
Dim dblArg1 As Double: dblArg1 =
Dim dblArg2 As Double: dblArg2 =
Dim dblArg3 As Double: dblArg3 =
Dim dblArg4 As Double: dblArg4 =
Dim dblHypGeom_Dist As Double
dblHypGeom_Dist = WorksheetFunction.HypGeom_Dist(Arg1:=dblArg1, Arg2:=dblArg2, Arg3:=dblArg3, Arg4:=dblArg4, Arg5:=True)
```

## Arguments

Arg1, Arg2, ..., Arg5Arg1 (Double) - Sample_s - the number of successes in the sample.

Arg2 (Double) - Number_sample - the size of the sample.

Arg3 (Double) - Population_s - the number of successes in the population.

Arg4 (Double) - Number_population - the population size.

Arg5 (Boolean) - Cumulative - a logical value that determines the form of the function. If cumulative is True, HypGeom_Dist returns the cumulative distribution function; if False, it returns the probability mass function.