Combinations FunctionMath Probability Class

Public Function Combinations( _
ByVal vNumber As Variant _
, ByVal vChosen As Variant _
) As Variant

Combinations of N things taken C at a time, WITHOUT repetition.

Summary: Function returns the number of possible ways of arranging C objects chosen from N objects when the order of the chosen objects does not matter, such as in playing card games.
Examples:
Combinations(1, 1) = 1
Combinations(2, 1) = 2
Combinations(2, 2) = 1
Combinations(4, 1) = 4
Combinations(4, 2) = 6
Combinations(4, 3) = 4
Combinations(4, 4) = 1
Combinations(21, 9) = 293930
IsNull(Combinations(9, 21)) = True
See also:
CombinationsWithRepetitions Function
Permutations Function
Factorial Function
COMB Function (Microsoft Excel)
vNumber: The number of unique items from which combinations can be constructed. Function returns Null if vNumber is Null, cannot be interpreted as a number, is less than zero (<0), or is less than vChosen. vNumber will be rounded down to the nearest integer.
vChosen: The number of items which are to be combined each time some are selected. Function returns Null if vChosen is Null, cannot be interpreted as a number, or is less than zero (<0). vChosen will be rounded down to the nearest integer.
Note: Function will return Null instead of generating an error if any of its calculations cause Overflow or other types of errors.
Definition:
Factorial(N) / (Factorial(C) * Factorial(N - C))
v1.5 Pro Note: The argument names and the implementation of this function has changed.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.