Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This shouldn't be hard for the excel experts.
here's my code: Function RandNormCorr(mean1, sd1, mean2, sd2, corr) 'returns two random numbers that are based on different distributions 'and has a certain correlation Dim xymat(1, 2) As Variant 'output array Dim z1 As Variant Dim z2 As Variant z1 = gauss 'gauss is a random number generation function z2 = gauss x = z1 * Sqr((1 + corr) / 2) + z2 * Sqr((1 - corr) / 2) y = z1 * Sqr((1 + corr) / 2) - z2 * Sqr((1 - corr) / 2) xymat(1, 1) = mean1 + x * sd1 xymat(1, 2) = mean2 + y * sd2 RandNormCorr = xymat End Function I want a (1,2) array to show: mean1 + x * sd1 on the left cell and mean2 + y * sd2 on the right cell Of course I highlight a 1x2 range, type the function, the ctrl+shift+enter this is what comes out: 0 0 pressing f2 f9 will reveal this ={0,0,0;0,-0.926298991003733,-1.12127338720803} ={0,0,0;0,-1.57926241712754,-0.0663085926997917 -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Create a List Output from a Horizontal Array Input | Excel Worksheet Functions | |||
Prevent cell/array references from changing when altering/moving thecell/array | Excel Discussion (Misc queries) | |||
meaning of : IF(Switch; Average(array A, array B); array A) | Excel Worksheet Functions | |||
customise array formula output | Excel Discussion (Misc queries) | |||
Getting output from an excel output back to cscript.. | Excel Programming |