Hi,

I have implemented the following code in vba excel and i have a problem.The code that i have implemented is the Erlang B traffic formula.I have two inputs:the traffic A and n=channel number.When i introduce for the traffic an input greater than 100 i have a value error.For inputs from 0 to 100 the formula give's me the expected value ,but for values greater than 100 ,the error occurs.

I hope that one of you can clear me.
Thanks.

Private Const GoS As Double = 0.001



Private Function Erl_B(A As Double, n As Integer) As Double
Dim BlRate As Double
Dim numarator As Double
Dim numitor As Double
Dim x As Integer



Do
numarator = A ^ n / WorksheetFunction.fact(n)
For x = n To n
numitor = numitor + A ^ x / WorksheetFunction.fact(x)
Next x
BlRate = numarator / numitor
n = n + 1

Loop Until (BlRate <= GoS)

Erl_B = n - 1

End Function