Average of Lowest Four Values from the Last Six Values, excluding Blanks

rphill48

New Member
Joined
Aug 5, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Microsoft Excel 365
Windows

I want to create a formula I can drag down as I add values. I'm looking to calculate the average of the four lowest values at out at least the last four values but not more than the last six, excluding blanks. See a screen cap below with examples.

Red Group - shows that only four values were available so the average was calculated for those four values.
Purple Group - shows there are blank values, so the list expanded to capture the last six, excluding blanks.

1628183697747.png


Thank you!
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Welcome to the MrExcel forum!

There's got to be something simpler than this, but try:

Book1
ABC
21Week 130
22Week 232
23Week 334
24Week 43633
25Week 53833
26Week 64033
27Week 74235
28Week 835
29Week 94237
30Week 104038.5
31Week 1138.5
32Week 1238.5
33Week 133839
34Week 143638.5
35Week 153437
36Week 163235
37Week 173033
38Week 182831
39Week 192629
40
Sheet16
Cell Formulas
RangeFormula
C24:C39C24=AVERAGE(SMALL(INDEX(SORT(FILTER(CHOOSE({1,2},$B$21:$B24,ROW($B$21:$B24)),$B$21:$B24<>""),2,-1),SEQUENCE(MIN(6,COUNT($B$21:$B24)))),{1,2,3,4}))
 
Upvote 0
A somewhat shorter version:

Excel Formula:
=AVERAGE(AGGREGATE(15,6,INDEX(FILTER($B$21:$B24,$B$21:$B24<>""),1/(1/(SEQUENCE(6,,COUNT($B$21:$B24),-1)))),{1,2,3,4}))
 
Upvote 0
I'm looking for the same thing but in the horizontal fashion. I tried editing your formula for it but I had no success.
The numbers on the side/blue which correlate with each other are the numbers that I'd like to be averaged together. If it doesn't work horizontally. I'd could use a formula that recalls the previous 6 to an updating table as show but I need to figure out that as well.

Please help!
Thank you!

inbound5445483314670681300.jpg
 
Upvote 0
Welcome to the MrExcel forum!

I can see why you had trouble with it. I can barely remember how it works. Give this a shot:

Book1
ABCDEFGHIJKLMNOPQRSTUV
11st2nd3rd4th5th6thAverageAverage
245976224376224344
325694135694134.6666674.666667
447891147891155
57916710291671025.8333335.833333
6566856686.256.25
76826825.3333335.333333
Sheet28
Cell Formulas
RangeFormula
U2:U7U2=AVERAGE(N2#)
V2:V7V2=AVERAGE(INDEX(FILTER(B2:L2,B2:L2<>""),SEQUENCE(,MIN(6,COUNT(B2:L2)),MAX(COUNT(B2:L2)-5,1))))
N7:P7,N6:Q6,N2:S5N2=INDEX(FILTER(B2:L2,B2:L2<>""),SEQUENCE(,MIN(6,COUNT(B2:L2)),MAX(COUNT(B2:L2)-5,1)))
Dynamic array formulas.


If you want the actual numbers displayed that are included, use the N2 formula. Then you can use the basic U2 formula to get the average. If you don't want the numbers listed, you can just wrap the N2 formula in AVERAGE and get your answer (V2).

Hope this helps!
 
Upvote 0
Just a slight tweak to Eric's column V formula: By reversing the sequence, we could avoid the MAX calculation in there. I've also used LET to save counting twice. ?

21 08 30.xlsm
EFGHIJKLMNOPQ
1Average
24597622434
325694134.666667
44789115
5791671025.833333
656686.25
76825.333333
Average
Cell Formulas
RangeFormula
Q2:Q7Q2=LET(c,COUNT(E2:N2),AVERAGE(INDEX(FILTER(E2:N2,E2:N2<>""),SEQUENCE(MIN(6,c),,c,-1))))
 
Upvote 0
If you don't need to see the values used, you can get the formula a tad shorter with a different approach:

Excel Formula:
=AVERAGE(INDEX(2:2,LARGE(COLUMN(B2:L2)*(B2:L2<>""),MIN(6,COUNT(B2:L2)))):L2)
 
Upvote 0

Forum statistics

Threads
1,215,727
Messages
6,126,520
Members
449,316
Latest member
sravya

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