WorksheetFunction Class - Random values from LogInv needed

  • Thread starter Thread starter leebean337
  • Start date Start date
L

leebean337

Hi there

I am trying to create a function that will grab random values from a
given distribution (lognormal and beta in particular). I am currently
using the following code for lognormal:

dblValue = Application.WorksheetFunction.LogInv(Rnd(), v1, v2)

where v1 is my mean and v2 is my standard deviation. But each time I
try to run it, I get the error "Unable to get the LogInv property of
the Worksheet Function class"

Any suggestions?
 
What are the values in V1 and V2 when that line runs?

V2 better be greater than 0.
 
Hey,

v1=8500 (mean)
v2=3000 (sd)

I figured out the first part of the problem, that being that my values
are too large and excel can't handle the resulting figures.

Also, when I change v1=ln(8500) and v2=ln(3000) I end up with a result
(and even a decent one!)

But I'm still concerned that I'm not actually suppose to modify my
specified mean and sd. What do you think?

Thanks
 
What version of Excel? Try just Application.LogInv(). Version of Excel
prior to 97 did not support the WorksheetFunction keyword.

Jerry
 
It's been way too long since my last stats course.

But maybe someone will chime in.
 
See Help for LOGINV. You are attempting to calculate EXP(8500+3000*x) where
it should be true that ABS(x)<38.

EXP(8500) is about 12 orders of magnitude larger than the largest number
that Excel can calculate.

Jerry
 
Back
Top