moving averages

muppet77

Board Regular
Joined
Jan 24, 2004
Messages
223
i am trying to make a 6 value moving average.

the only problem is the list sometimes has non numeric data eg "" meaning a blank.

the data analysis tool doesn't calculate a moving average if there is non numeric data, and using a zero instead will alter the average.

any ideas?
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
looked at data again and still not really doing what i want it to. i'd like to have a 6 running average (data analysis tool pack does not like non entries). see example below, where i've used x in the data column to mean no data, and the first few averages are not given as there is not 6 pieces of data in the history. i'd prefer to stay away froma macro solution if possible. thanks in advance.

data, moving average 6
5, x
5 , x
3 , x
1, x
2 , x
x , x
5 , 3.5
8 , 4
x, 4
x , 4
7, 4.333333333
8 , 5.166666667
1 , 5.166666667
5 , 5.666666667
x , 5.666666667
1 , 5
2 , 4
 
Upvote 0
hope i explained that correctly - basically want to find the average of the 6 previous pieces of data above in the column.
 
Upvote 0
Try the following...

B1, copied down:

=IF(COUNT($A$1:A1)>=6,AVERAGE(INDEX($A$1:A1,LARGE(IF($A$1:A1<>"",ROW($A$1:A1)-CELL("row",$A$1)+1),6)):INDEX($A$1:A1,MATCH(9.99999999999999E+307,$A$1:A1))),"")

...confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,216,176
Messages
6,129,316
Members
449,501
Latest member
Amriddin

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