Average of last 3 numbers in non-continuous range

johannes2008

New Member
Joined
Aug 20, 2010
Messages
42
Office Version
  1. 365
Platform
  1. Windows
Hello

I am working on on a spreadsheet that uses the average of the last three months "actual" data to forecast the rest of the fiscal year. As "actual" data is entered for the next month I want the forecast value to update. To add to the complexity my "actual" data cells are non-continuous and not every cell has numbers in it. As well I want it to use the 4th, 3rd, and 2nd last data points as the last data point if for the current month and not complete yet.

1677276228879.png


So in the above example for row 4 the formula should take K4, H4 & E4, average them and return the value to S4. The formula should not use Q4 because it is empty nor use N4 as that is the current month and the data is not complete. However once a number is present in Q4 it should then use H4, K4 & N4 to calculate the average.

I hope this makes sense

Thanks
 
Pending answers to the above, you could test this as a starting point.

23 02 25.xlsm
ABCDEFGHIJKLMNOPQRS
2OctNovDecJanFebMar
3
4155595105158
Average
Cell Formulas
RangeFormula
S4S4=LET(f,FILTER(B4:R4,(B2:R2<>"")*(B4:R4<>"")),AVERAGE(INDEX(f,,SEQUENCE(,3,COLUMNS(f)-1,-1))))
Thanks for the suggestion. I have made it work for my spreadsheet except I believe its taking the averages from the wrong cells. It should be taking averages from the last 3 numbers it finds in columns G&H, O&P, W&X & AG&AH

=LET(f,FILTER(G114:AN114,(G114:AN114<>"")*(G114:AN114<>"")),AVERAGE(INDEX(f,,SEQUENCE(,8,COLUMNS(f)-1,-1))))
 
Upvote 0

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
What should happen in row 5?
What should happen if any row has some values but not enough to collect 3 relevant values?

More examples and expected results with XL2BB would be helpful.
In row 5 the answer/average would be 54.66
There will be enough data in each row as the document includes historical data.
 
Upvote 0
I believe its taking the averages from the wrong cells. It should be taking averages from the last 3 numbers it finds in columns G&H, O&P, W&X & AG&AH
Difficult to understand. Remember that all we have to go on is what you show and tell us.
  • What you showed us does go to the red ranges above.
  • Previously you said you wanted to average some 'Actual' numbers but the columns mentioned above (red) do not seem to correspond with the 'Actual' columns given (green) and why are some sections skipped anyway?

johannes2008.xlsm
BCDEFGHIJKLMNOPQR
1
2OctNovDecJanFebMar
3ActualActualActualActualActualActual
415559510515
5225585605895155
6245255645525155
75565851515
Average


  • Previously you told us the average should come from 2nd last, 3rd last and 4th last. Now you are saying last 3. Can you clarify the actual requirement?
As I said before ..
More examples and expected results with XL2BB would be helpful.
We cannot copy/paste data from images.
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,715
Members
448,985
Latest member
chocbudda

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