ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA and norminv (https://www.excelbanter.com/excel-programming/289782-vba-norminv.html)

ksnapp[_2_]

VBA and norminv
 
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)

--
Message posted from http://www.ExcelForum.com


Jerry W. Lewis

VBA and norminv
 
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

ksnapp < wrote:

hi

can anybody tell why this doesn't work, or better yet show me how to
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))



Dana DeLouis[_3_]

VBA and norminv
 
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


--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"ksnapp " wrote in message
...
hi

can anybody tell why this doesn't work, or better yet show me how to
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))


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 10:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com