Gesyca_is_joy
Board Regular
- Joined
- Apr 24, 2014
- Messages
- 90
- Office Version
- 365
- Platform
- Windows
I have a table in which I constantly add rows. I have a column in which i want to dynamically calculate the average of the past XX months.
Right now I am using the following formula in Column C for a 5 month average.
=Average(Offset(A1,COUNT(A2:A11),0,-5)
However it's not quite what I want because what i am looking for is a formula that calcuates the average for the previous 5 rows based on each cell...so row 6 would average rows 1-5, and row 7 would average rows 2-6 and so on.
[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]Month[/TD]
[TD]Number[/TD]
[TD]Average[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]15[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]19[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]18[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]17[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]16[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]15[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]18[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]19[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]21[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]22[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Right now I am using the following formula in Column C for a 5 month average.
=Average(Offset(A1,COUNT(A2:A11),0,-5)
However it's not quite what I want because what i am looking for is a formula that calcuates the average for the previous 5 rows based on each cell...so row 6 would average rows 1-5, and row 7 would average rows 2-6 and so on.
[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]Month[/TD]
[TD]Number[/TD]
[TD]Average[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]15[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]19[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]18[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]17[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]16[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]15[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]18[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]19[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]21[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]22[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]