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?
 

Some videos you may like

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Pekkavee

Well-known Member
Joined
May 25, 2004
Messages
1,218
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:
 

muppet77

Board Regular
Joined
Jan 24, 2004
Messages
223
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
 

Pekkavee

Well-known Member
Joined
May 25, 2004
Messages
1,218
OK. Sorry it's not working like you had in mind.

I hope somebody finds a way :biggrin:

Pekka
 

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
19,406

ADVERTISEMENT

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!
 

muppet77

Board Regular
Joined
Jan 24, 2004
Messages
223
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.
 

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
19,406

ADVERTISEMENT

Sorry! Forgot to mention the all important...

'confirm with CONTROL+SHIFT+ENTER'

Hope this helps!
 

muppet77

Board Regular
Joined
Jan 24, 2004
Messages
223
so i paste it in then press CSE simultaneously? doesn't seem to work. must be me!

cheers for your time.
 

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
19,406
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!
 

Watch MrExcel Video

Forum statistics

Threads
1,122,499
Messages
5,596,515
Members
414,074
Latest member
Matthew Kakde

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
Top