Normal Random Generator

  • Thread starter Thread starter miong
  • Start date Start date
M

miong

Hi,

I am working on a simulation project in Excel/VBA and
need to generate normal random variables by function
Norminv. The compiler doesn't know this function. I guess
that I have to select/add a certain Add-In to activate
this function. Does anyone know which Add-In or how to
use this function in VBA?

Thanks

Ming
 
Ming -
I am working on a simulation project in Excel/VBA and need to generate
normal random variables by function Norminv. The compiler doesn't know this
function. I guess that I have to select/add a certain Add-In to activate
this function. Does anyone know which Add-In or how to use this function in
VBA? <

Use the same approach you would use with any worksheet function in VBA:

Result = Application.WorksheetFunction.Norminv(prob,mean,stdev)

Be aware of numerical inaccuracies of Norminv in pre-2002 versions of Excel.

- Mike Middleton, www.usfca.edu/~middleton
 
Michael said:
Ming -


normal random variables by function Norminv. The compiler doesn't know this
function. I guess that I have to select/add a certain Add-In to activate
this function. Does anyone know which Add-In or how to use this function in
VBA? <

Use the same approach you would use with any worksheet function in VBA:

Result = Application.WorksheetFunction.Norminv(prob,mean,stdev)

Be aware of numerical inaccuracies of Norminv in pre-2002 versions of Excel.


Actually you need 2003 for this to be a reasonable RNG method. 2002 has
a better inverse of NormSDist than previous versions, but NormSDist is
still lousy in the tails till 2003.

Jerry
 
Back
Top