'********************************************************************

'*

'* Function Combinations

'*

'*   Author: NetworkAdminKB.com

'*  Created: 2004-12-21

'* Modified: 2004-12-21

'*

'* Purpose: Return the number of Combinations for numItems from numPool.

'*

'* Input: numItems = The number of elements that make up the combination.

'*        numPool  = The number of elements in the pool that numItems

'*                     is taken from.

'*

'* Output: Returns the number of Combinations for numItems from numPool.

'*

'* Calls:

'* Factorial

'*

'********************************************************************

Function Combinations(ByVal numItems, ByVal numPool)

  'Cominations = P! / I! * (P-I)!  (P=Pool, I=Items)

  If numItems <= numPool and numItems > 0 and numPool > 0 Then

    Combinations = Factorial(numPool) / (Factorial(numPool - numItems) * _

                     Factorial(numItems))

  Else

    Combinations = 0

  End If 'numItems >= numPool

End Function 'Combinations

Article ID: 375, Created On: 9/25/2011, Modified: 9/25/2011