Dynamic Average of top values in specific ranges

santomax

New Member
Joined
Aug 27, 2022
Messages
6
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
  6. 2011
  7. 2010
  8. 2007
Platform
  1. Windows
Hi everyone.

Im trying to find the average of the top values of several- non continued ranges. see image for reference:

1677779976604.png



What I need is being able to average the TOP value of range B4:B15 with the TOP (the ones in green) value of B17:28 and so on for the next following cells that are not in yellow. So basically doing an average of the max values found every 12 rows.

I had a formula that worked for me when my data was organized a little bit different (every 11 rows), but I need to follow this structure now.
Formula example: =LET(A,A3:A1904,B,B3:B1904,C,BYROW(WRAPROWS(FILTER(B,A=""),11),LAMBDA(x,MAX(x))),AVERAGE(FILTER(C,C<>0)))

Test Sample.xlsx
ABC
1test
2Datetesttest/Hr
31/1/202352287.0
413826.4%
513726.2%
67213.8%
77113.6%
86412.3%
9112.1%
10295.6%
11-
12-
13-
14-
15-
161/1/202324649.2
173915.9%
187113.6%
198616.5%
20366.9%
21132.5%
2210.2%
23-
24-
25-
26-
27-
28-
291/1/2023647107.8
308913.8%
3110720.5%
329117.4%
33203.8%
3410820.7%
3513024.9%
3610219.5%
37-
38-
39-
40-
41-
421/1/202354477.7
437814.3%
4411722.4%
4510219.5%
465610.7%
478416.1%
48377.1%
496512.5%
5051.0%
51-
52-
53-
54-
551/1/202357495.7
567813.6%
5711221.5%
5811421.8%
5911221.5%
609518.2%
61489.2%
62152.9%
63-
64-
65-
66-
67-
681/1/202368085.0
697410.9%
709818.8%
7110620.3%
72479.0%
7312023.0%
747013.4%
7510319.7%
766211.9%
77-
78-
79-
80-
811/1/202368476.0
82426.1%
836412.3%
847614.6%
856211.9%
8612624.1%
879317.8%
887514.4%
899518.2%
90519.8%
91-
92-
93-
941/1/202341082.0
959823.9%
9610319.7%
978616.5%
985510.5%
996412.3%
10040.8%
101-
102-
103-
104-
105-
106-
1071/1/202348997.8
10814229.0%
10913225.3%
1108015.3%
11110219.5%
112326.1%
11310.2%
114-
115-
116-
117-
118-
119-
1201/1/202357896.3
1216310.9%
12210620.3%
1239818.8%
1247514.4%
1259818.8%
12611822.6%
127203.8%
128-
129-
130-
131-
132-
1331/1/20231021102.1
13411611.4%
13511622.2%
13610820.7%
1376011.5%
1389618.4%
1399618.4%
14012924.7%
14116431.4%
1428015.3%
1435610.7%
144-
145-
Test
Cell Formulas
RangeFormula
B3,B133,B120,B107,B94,B81,B68,B55,B42,B29,B16B3=IF(SUM(B4:B15)=0,"-",(SUM(B4:B15)))
C3,C16,C29,C42,C55,C68,C81,C94,C107,C120,C133C3=IF(ISERROR((B3/(COUNTIF(B4:B15,">="&B3*0.05)))),"-",((B3/(COUNTIF(B4:B15,">="&B3*0.05)))))
C4,C17,C30,C43,C56,C69,C82,C95,C108,C121,C134C4=IF(B4="","-",(B4*100)/B3)
C5:C15,C18:C28,C31:C41,C44:C54,C57:C67,C70:C80,C83:C93,C96:C106,C109:C119,C122:C132,C135:C145C5=IF(B5="","-",(B5*100)/B$3)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B134Cell Valuetop 1 valuestextYES
B135:B143Cell Valuetop 1 valuestextYES
B121:B127Cell Valuetop 1 valuestextYES
B108:B113Cell Valuetop 1 valuestextYES
B95:B100Cell Valuetop 1 valuestextYES
B82:B90Cell Valuetop 1 valuestextYES
B69:B76Cell Valuetop 1 valuestextYES
B56:B63Cell Valuetop 1 valuestextYES
B43:B50Cell Valuetop 1 valuestextYES
B30:B37Cell Valuetop 1 valuestextYES
B17:B23Cell Valuetop 1 valuestextYES
B4:B12Cell Valuetop 1 valuestextYES
B144:B145Cell Valuetop 1 valuestextYES
B128Cell Valuetop 1 valuestextYES
B129:B132Cell Valuetop 1 valuestextYES
B114:B115Cell Valuetop 1 valuestextYES
B116:B119Cell Valuetop 1 valuestextYES
B101:B102Cell Valuetop 1 valuestextYES
B103:B106Cell Valuetop 1 valuestextYES
B91:B93Cell Valuetop 1 valuestextYES
B77:B80Cell Valuetop 1 valuestextYES
B64:B67Cell Valuetop 1 valuestextYES
B51:B54Cell Valuetop 1 valuestextYES
B38:B41Cell Valuetop 1 valuestextYES
B24Cell Valuetop 1 valuestextYES
B25:B28Cell Valuetop 1 valuestextYES
B13:B15Cell Valuetop 1 valuestextYES


Im kinda lost on how to do what im looking for. I have tried just modding my original formula but I kinda gave up. If you guys have any ideas, they are all welcome.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
How about
Excel Formula:
=LET(A,A3:A1904,B,B3:B1904,C,BYROW(WRAPROWS(FILTER(B,A=""),12,""),LAMBDA(x,MAX(x))),AVERAGE(FILTER(C,C<>0)))
 
Upvote 1
Solution
How about
Excel Formula:
=LET(A,A3:A1904,B,B3:B1904,C,BYROW(WRAPROWS(FILTER(B,A=""),12,""),LAMBDA(x,MAX(x))),AVERAGE(FILTER(C,C<>0)))
I cannot believe I was just missing the "" xD
Thank you so, it works just fine with the 12 instead of 11
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,121
Members
453,021
Latest member
Justyna P

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