Dynamic Offset Average

Gesyca_is_joy

Board Regular
Joined
Apr 24, 2014
Messages
90
Office Version
  1. 365
Platform
  1. 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.


ABC
MonthNumberAverage
115
219
318
417
516
615
718
819
921
1022

<tbody>
</tbody>
 
YAY thank you so much!! That works, even as I change the value in F1 and add more rows... thank you!

Now, will you please educate me on what this formula is doing so I can learn? I am well familiar with IF, COUNT and AVERAGE, but the OFFSET is what i’m Confused about. I can see the formula is counting the values in the Actuals column, returning a blank if they don’t comply with the criteria in F1 and averaging the values if they do, but what is (OFFSET([@Actuals],-$F$1,,$F$1,) actually saying? I looked it up on Google a bunch before I came to this forum but I can’t seem to wrap my head around it for some reason.



Hi,

RollingAverage: =IF(COUNT(OFFSET([@Actuals],-$F$1,,$F$1,))<>$F$1,"",AVERAGE(OFFSET([@Actuals],-$F$1,,$F$1,)))


CTRL+SHIFT+Enter

:cool:


Greetings



Christian
 
Upvote 0

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hi,

AVERAGE(OFFSET([@Actuals],-$F$1,,$F$1,) says:

go from the actual row in Column Actuals x rows up (-$F$1), from this cell take a Heigh with x ($F$1)

for i.e.: the actual row is row 5 in column Actuals, F1=4, so you go up 4 rows, you are in row 1, take a Heigh with 4 Rows (=row 1,2,3,4 from the column Actuals).

Hope, my explanation will help you.

Geetings


Christian

 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,238
Members
448,555
Latest member
RobertJones1986

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