Public Function Factorial(ByVal factor As Double) As Double If factor = 0 Then Factorial = 1 Else Factorial = factor * Factorial(factor - 1) End If Exit Function Return (Factorial) End Function Public Function Permutations(ByVal a As Double, ByVal b As Double) As Double Permutations = Factorial(a) / Factorial(a - b) Return (Permutations) End Function Public Function Combinations(ByVal a As Integer, ByVal b As Integer) As Integer Combinations = Permutations(a, b) / Factorial(b) End Function