Thread: [Solved] 30 Shift Rolling Average
View Single Post
 
Old 05-30-2014, 04:46 PM
PressF1 PressF1 is offline Mac OS X Office 2013
Novice
 
Join Date: May 2014
Location: Sydney, Australia
Posts: 3
PressF1 is on a distinguished road
Default

I think there are two ways of looking at this. First is how you structure your data - often people constrain the problem by how they setup their worksheet or by how others ask for the information to be presented. If you added information in reverse chronological order (i.e. add new data at the top of the table) there is an easier solution.

Anyway, using the structure you have provided try adding a reverse counter in column F (in F68 =G68+F69). Then your formula should look like this:
=SUMPRODUCT(H15:H68,N((F15:F68)<31))/SUMPRODUCT(G15:G68,N((F15:F68)<31))

Remove the hardcode 31 and replace it with a reference to a cell where you can change it if requirements change (e.g. average of the last 20 shifts) and you will have a dynamic solution.

The disadvantage of this solution is that the SUMPRODUCT is an array formula and the more data you have in your workbook where you use this formula may slow down calculation times.
Reply With Quote