VBA Moving Average question

unisruin26

New Member
Joined
Sep 9, 2015
Messages
1
Hi guys,

I'm the first time using Excel VBA. The question is Given the formulas for moving average and corresponding moving standard deviation, develop the code that uses n, number of past observations, as an input in to the calculations in such a way that n can be changed dynamically updating results without need to copy formulas or adjust range of data used in formulas. There are 1000 random numbers from A1:A1000.

anyone could help with?

Thanks!

Hanson
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
the average of A1 to A3 is sum(A1:A3)/3

you need to replace the 1,3,3 with variables

say D1=1 E1=3

=sum((""A"&"D1""):(""A"&"E1""))

is the "sort of thing you want" so check out formatting
 
Upvote 0
413
5
6
6
=INDIRECT("A"&(VALUE(E1)))

<colgroup><col width="64" span="6" style="width:48pt"> </colgroup><tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,216,531
Messages
6,131,209
Members
449,636
Latest member
ajdebm

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top