WorksheetFunction.HypGeom_Dist Method

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.

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

Syntax

'Declaration
Function HypGeom_Dist ( _
    Arg1 As Double, _
    Arg2 As Double, _
    Arg3 As Double, _
    Arg4 As Double, _
    Arg5 As Boolean _
) As Double
'Usage
Dim instance As WorksheetFunction
Dim Arg1 As Double
Dim Arg2 As Double
Dim Arg3 As Double
Dim Arg4 As Double
Dim Arg5 As Boolean
Dim returnValue As Double

returnValue = instance.HypGeom_Dist(Arg1, _
    Arg2, Arg3, Arg4, Arg5)
double HypGeom_Dist(
    double Arg1,
    double Arg2,
    double Arg3,
    double Arg4,
    bool Arg5
)

Parameters

  • Arg1
    Type: System.Double

    Sample_s - the number of successes in the sample.

  • Arg2
    Type: System.Double

    Number_sample - the size of the sample.

  • Arg3
    Type: System.Double

    Population_s - the number of successes in the population.

  • Arg4
    Type: System.Double

    Number_population - the population size.

  • Arg5
    Type: System.Boolean

    Cumulative - a logical value that determines the form of the function. If cumulative is true, then HypGeom_Dist returns the cumulative distribution function; if false, it returns the probability mass function.

Return Value

Type: System.Double

Remarks

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:

Figure 1: Equation for the hypergeometric distribution

Equation for the hypergeometric distribution

where:

x = sample_s

n = number_sample

M = population_s

N = number_population

HypGeom_Dist is used in sampling without replacement from a finite population.

See Also

Reference

WorksheetFunction Interface

WorksheetFunction Members

Microsoft.Office.Interop.Excel Namespace