E
Eric Johnson
What is the best way to calculate moving averages within VBA? I have an
array of values: MyArray(1 to 1000, 1 to 1)
I would like to fill MyOtherArray(1 to 1000, 1 to 1) with 50-value moving
averages of the values in MyArray.
So for x=1 to 49, MyOtherArray(x,1) would be equal to #N/A, because there
are not yet 50 values to average
For x=50, MyOtherArray(50,1) would be equal to the average of the first 50
values of MyArray.
If I were calculating moving averages in a worksheet, I would take the
average of 50 cell ranges using the offset function. What would be a good
way to do this within VBA?
Thanks!
array of values: MyArray(1 to 1000, 1 to 1)
I would like to fill MyOtherArray(1 to 1000, 1 to 1) with 50-value moving
averages of the values in MyArray.
So for x=1 to 49, MyOtherArray(x,1) would be equal to #N/A, because there
are not yet 50 values to average
For x=50, MyOtherArray(50,1) would be equal to the average of the first 50
values of MyArray.
If I were calculating moving averages in a worksheet, I would take the
average of 50 cell ranges using the offset function. What would be a good
way to do this within VBA?
Thanks!