WorksheetFunction.HypGeomDist Method
Returns the hypergeometric distribution. HypGeomDist returns the probability of a given number of sample successes, given the sample size, population successes, and population size. Use HypGeomDist 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 HypGeomDist ( _
Arg1 As Double, _
Arg2 As Double, _
Arg3 As Double, _
Arg4 As Double _
) As Double
'Usage
Dim instance As WorksheetFunction
Dim Arg1 As Double
Dim Arg2 As Double
Dim Arg3 As Double
Dim Arg4 As Double
Dim returnValue As Double
returnValue = instance.HypGeomDist(Arg1, _
Arg2, Arg3, Arg4)
double HypGeomDist(
double Arg1,
double Arg2,
double Arg3,
double Arg4
)
Parameters
Arg1
Type: System.DoubleSample_s - the number of successes in the sample.
Arg2
Type: System.DoubleNumber_sample - the size of the sample.
Arg3
Type: System.DoublePopulation_s - the number of successes in the population.
Arg4
Type: System.DoubleNumber_population - the population size.
Return Value
Type: System.Double
Remarks
Important
This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality. For more information about the new function, see the HypGeom_Dist(Double, Double, Double, Double, Boolean) method.
All arguments are truncated to integers.
If any argument is nonnumeric, HypGeomDist returns the #VALUE! error value.
If sample_s < 0 or sample_s is greater than the lesser of number_sample or population_s, HypGeomDist returns the #NUM! error value.
If sample_s is less than the larger of 0 or (number_sample - number_population + population_s), HypGeomDist returns the #NUM! error value.
If number_sample ≤ 0 or number_sample > number_population, HYPGEOMDIST returns the #NUM! error value.
If population_s ≤ 0 or population_s > number_population, HypGeomDist returns the #NUM! error value.
If number_population ≤ 0, HypGeomDist returns the #NUM! error value.
The equation for the hypergeometric distribution is:
Figure 1: Equation for the hypergeometric distribution
where:
x = sample_s
n = number_sample
M = population_s
N = number_population
HypGeomDist is used in sampling without replacement from a finite population.