Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Oct 27, 4:24*pm, busboy10 wrote:
I have downloaded monthly returns for the S&P and histogramed it out to find the distribution with mean and stddev. Now I would like Excel to generate a random monthly return based on the historical distribution. Suppose the mean is in A1 and std dev is in A2. Then use: =NORMINV(RAND(),A1,A2) Caveat: RAND() is a volatile function. So the formula will be recalculated after editing any cell in any worksheet of the workbook. One way to avoid that is to use the myRand() UDF below. You can use it exactly as you use RAND(). Or you can use myRand(X1), which will recalculate any formula with that expression after you edit X1, including simply selecting X1and pressing F2 then Enter. Function myRand(Optional r As Range) As Double myRand = Evaluate("rand()") End Function To enter myRand(), press atl+F11 to open a VBA window, click Insert Module to open a VBA module editing pane, and copy-and-paste the above text into the editing pane. You can now close the VBA window. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Seed numbers for random number generation, uniform distribution | Excel Discussion (Misc queries) | |||
Random Number Generator help | Excel Programming | |||
Random Number generator | Excel Worksheet Functions | |||
Random Number Generator | Excel Programming | |||
Random Number Generator | Excel Programming |