Code for moving average range in Column

djdave007

New Member
Joined
Sep 17, 2008
Messages
13
Hi,
Im wondering if it's possible to write a code to record a moving range in column D taking into consideration only the LAST 30 entries? Hopefully Im explaining myself correctly.

If column has say 50 values, I would like Cell E1 to show the latest calculated moving range.
In this instance the moving range would be:
range of D21:D22
range of D22:D23
range of D23:D24
etc
Then the sum of these ranges, and divided by 30.

This value is then put into Cell E1.

When its running if I have 100 entries, I still get the overall average range but only for the 70th to 100th entry.

Plz help...it's killing me..
I have done it before, but when I did it I had to write individual formulas and have a table of raw calculations. Also I had to keep manually copying the formula down ready for the next entry....
Was really hoping there is an easier way.

thanks loads
dave
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hi
if there are no blank cells in col D, try
E1=AVERAGE(INDIRECT("D" & COUNT(D:D) -30 & ":D" & COUNT(D:D)))
returns the mean of last 30 entries.
ravi
 
Upvote 0

Forum statistics

Threads
1,213,567
Messages
6,114,342
Members
448,570
Latest member
rik81h

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