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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
If you have your numbers in column A so

in B6 input =SUM(A1:A6)/COUNT(A1:A6)

and copy down.

Regards
Pekka
:eek: :eek: :eek:
 
Upvote 0
that looks at the last 6 CELLS, and not the last 6 VALUES. sometimes there may be 2 blanks together.

eg
2
6
4
""
6
""
""
6
88
3
 
Upvote 0
Try the following...

=AVERAGE(INDEX(A:A,LARGE(IF(A1:A100<>"",ROW(A1:A100)),6)):INDEX(A:A,MATCH(9.99999999999999E+307,A:A)))

Hope this helps!
 
Upvote 0
cheers for your efforts fellas.

not sure where to put your formula domenic. got data in col A. put yours in b1 and it just gives NUM error.
 
Upvote 0
Sorry! Forgot to mention the all important...

'confirm with CONTROL+SHIFT+ENTER'

Hope this helps!
 
Upvote 0
so i paste it in then press CSE simultaneously? doesn't seem to work. must be me!

cheers for your time.
 
Upvote 0
After you enter the formula, hold the CONTROL and SHIFT keys down, then while you have them pressed, hit the ENTER key. Excel should place braces {} around the formula and you'll know you've entered it correctly.

The other possibility is that you have less than 6 values in your column. Is that the case? If so, try...

=AVERAGE(INDEX(A:A,LARGE(IF(A1:A100<>"",ROW(A1:A100)),MIN(6,COUNT(A1:A100)))):INDEX(A:A,MATCH(9.99999999999999E+307,A:A)))

...confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,732
Members
448,987
Latest member
marion_davis

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