VBA and norminv

  • Thread starter Thread starter ksnapp
  • Start date Start date
K

ksnapp

hi

can anybody tell why this doesn't work, or better yet show me how t
make it work

Function Dandy(P As Double, rng)
Dim M As Double
M = Application.Average(rng)
Dim S As Double
S = Application.StDev(rng)

Dandy = Application.Norminv(P, M, S)
End Function

What im tryin to do is write a UDF tha replaces this
=Norminv(P, average(range), Stdev(range)
 
It seems to work for me in Excel XP. Give an example of what you are
passing and what unacceptable results you are getting.

Jerry
 
I'm not a stats person, but would taking the StDev of the population
(StDevP) work? I am not sure what you mean by "doesn't work."

Function Dandy(P As Double, rng As Range)
Dim M As Double
Dim S As Double

With WorksheetFunction
M = .Average(rng)
S = .StDevP(rng)
Dandy = .NormInv(P, M, S)
End With
End Function
 
Back
Top