I have a column of data covering 365 days, some of the cells have data and
some don't. I am trying to figure out how to calculate a 30 day moving
average ignoring blank cells. In other words, I want the average of the last
30 days that have a data value in the cell. The moving average may have to
look back at the last 50 to 60 days in order to get 30 days that have values
to average. I would appreciate any suggestions how to calculate this.
Hi!
What if there aren't 30 days of data to average?
Assume your values are in the range A1:A365
Entered as an array using the key combo of CTRL,SHIFT,ENTER:
=AVERAGE(A365:INDEX(A1:A365,LARGE(IF(A1:A365lt;gt;quot;quot;,R OW(A1:A365)),30)))
If there aren't 30 values this version will average all values until there
are 30 or more, then it will average the last 30.
=AVERAGE(A365:INDEX(A1:A365,LARGE(IF(A1:A365lt;gt;quot;quot;,R OW(A1:A365)),MIN(COUNT(A1:A365),30))))
Biff
quot;ethatchquot; gt; wrote in message
...
gt;I have a column of data covering 365 days, some of the cells have data and
gt; some don't. I am trying to figure out how to calculate a 30 day moving
gt; average ignoring blank cells. In other words, I want the average of the
gt; last
gt; 30 days that have a data value in the cell. The moving average may have
gt; to
gt; look back at the last 50 to 60 days in order to get 30 days that have
gt; values
gt; to average. I would appreciate any suggestions how to calculate this.
quot;ethatchquot; gt; wrote...
gt;I have a column of data covering 365 days, some of the cells have data and
gt;some don't. I am trying to figure out how to calculate a 30 day moving
gt;average ignoring blank cells. In other words, I want the average of the
gt;last
gt;30 days that have a data value in the cell. The moving average may have to
gt;look back at the last 50 to 60 days in order to get 30 days that have
gt;values
gt;to average. I would appreciate any suggestions how to calculate this.
If your data were in C5:C369, then you could calculate 30 day moving
averages using array formulas like
D5:
=IF(AND(COUNT(C$5:C5)gt;=30,COUNT(C5)),
AVERAGE(INDEX(C$5:C5,MATCH(COUNT(C$5:C5)-29,
MMULT(--(ROW(C$5:C5)gt;=TRANSPOSE(ROW(C$5:C5))),--ISNUMBER(C$5:C5)),
0)):C5),quot;quot;)
Fill D5 down into D6369. This will evaluate to quot;quot; until you reach the row
with the 30th number in col C and on any row thereafter in which col C
doesn't contain a number.
- Aug 28 Tue 2007 20:38
30 Day Moving Average Ignoring Blank Cells
close
全站熱搜
留言列表
發表留言