The hypergeometric distribution is a discrete probability distribution that gives the probability of a specified number of successes from a given number of draws from a finite population, without replacement.
The Hypergeometric Distribution is given by the formula:
where,
x = number of successes in the sample; 
n = number in the sample; 
M = number of successes in the population; 
N = population size. 
In Excel 2010, the Hypgeomdist function has been replaced by the Hypgeom.Dist function, which has improved accuracy.
Although it has been replaced, the Hypgeomdist function is still available in Excel 2010 (stored in the list of compatibility functions), to allow compatibility with earlier versions of Excel.
The Excel Hypgeomdist function returns the value of the hypergeometric distribution for a given number of successes from a sample of a population.
The syntax of the function is:
Where the function arguments are:
sample_s    The number of successes in the sample. 
number_sample    The size of the sample. 
population_s    The number of successes in the population. 
number_pop    The population size. 
The above arguments should all be integers. If these values are supplied as decimals, they are truncated to integers by Excel.
Formulas:
 
Results:

Imagine you have a bag, containing 4 red balls and 8 green balls.
If you remove 4 balls from the bag, the probability that you have selected exactly n red balls can be calculated by the Excel Hypgeomdist function.
This is shown in cells A2A5 of the above spreadsheet on the right.
Further examples of the Excel Hypgeomdist function are provided on the Microsoft Office website.
If you get an error from the Excel Hypgeomdist function this is likely to be one of the following:
#NUM!    Occurs if either:

#VALUE!    Occurs if any of the supplied arguments are nonnumeric. 