Page 1 of 1

VBA Function for mean and standard deviation of an Array

Posted: March 12th, 2007, 5:54 am
by tttchen
I'm not a great programmer and was hoping someone could help me with a basic VBA question (for Excel).I've written a simulation; assume that each simulation run consists of 1000 trials. In my simulation, I care about 3 values, which are stored in an array "Value". The dimensions for Value are: Value(3,1000) (reflecting the 3 values and the 1000 trials).Is there a VBA function that will give me the mean and standard deviation for each of the Values (so I want the mean and stdev for Value(1,1..1000), Value(2,1..1000) and Value(3,1000))? It's a bit tedious and computationally wasteful to brute force calculate the mean and standard deviation as the actual number of trials and variables I care about are greater than this example.Thanks!

VBA Function for mean and standard deviation of an Array

Posted: March 12th, 2007, 8:51 am
by sanjaysivakumar
you can use application.worksheetfunction.average()/(stdev()) for each 1000 simulation.

VBA Function for mean and standard deviation of an Array

Posted: March 12th, 2007, 8:51 am
by sanjaysivakumar
you can use application.worksheetfunction.average()/(stdev()) for each 1000 simulation.