Dynamic Top/bottom calculation

alizok

Board Regular
Joined
Sep 12, 2002
Messages
88
Office Version
  1. 365
I need the assistance of this group in developing a formula that will dynamically modify dependent on the number of records in the database. I need to figure out the top 10%, top 25%, top 30%, bottom 10%, bottom 25%, and so on. Is there a formula that can automatically calculate this information? Typically, I rank the data, then sort it from smallest to largest, and then determine the average of a certain data set manually depending on the percentage. see attached for more details.

Thank you in advance for all your help
 

Attachments

  • excel_TOP_BOTTOM.png
    excel_TOP_BOTTOM.png
    39.7 KB · Views: 21

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
thank you for the formula but I'm not sure if it's doing what I'm looking for. I just simply need to enter the count of records in the row and then the excel knows to calculate the average of the top or bottom records. In your example, if I'm looking for the top 10% the result should be 256.29
Try putting this in cell B3 in my example above:
Excel Formula:
=AVERAGE(IF(ROWS($A$3:A3)>COUNTA($A:$A)*(10/100),"", AGGREGATE(14,4,$A:$A, COUNTA($A$3:$A3))))
 
Upvote 0
no it still doesn't seem to be doing what i need. Please see the screen shot attached. The top 10% of 53 employees equal to 5.3 in which case i take the average of the top 5 employees to figure out the earnings for the top 10% of employees. For the next 25% i look at the top 13 employees (53*25%) and so on. The same is true for the bottom but instead of looking for the top i'm looking at the bottom 5EEs .
 

Attachments

  • Screenshot 2023-03-06 121048.png
    Screenshot 2023-03-06 121048.png
    65.4 KB · Views: 4
Upvote 0
As you cannot use the XL2BB add-in, can you just copy/paste the data.
 
Upvote 0
That is another image & I see no point in retyping what you have already got. So once again please post your data not an image.
 
Upvote 0
Just copy/paste the data to the board.
 
Upvote 0
1ABCDEFG
2
3countResultscountResults
4Top 10
5​
$26,800​
5​
$236,320​
5Top 25%
13​
$36,690​
13​
$190,342​
6Avg
$30,054​
$111,081​
7Bottom 25%
13​
$20,667​
13​
$88,258​
8Bottom 10%
5​
$13,375​
5​
$85,365​
9
10Total count
53​
51​
11Jan Attn%Jan Attn% RankJan Earning$Feb-Oct Attn%Feb-Oct Attn% RankFeb-Oct Earning$
1297.2%42$15,47530810.0%1$136,775
13244.4%5$67,5009220.0%2$282,500
14191.5%13$78,3007333.3%3$296,025
15166.7%14$56,8757300.0%4$225,625
16215.6%9$78,8506720.0%5$240,675
17151.1%19$47,5506600.0%6$225,450
18195.6%11$69,8506340.0%7$252,250
19115.6%30$43,2255400.0%8$185,525
20137.8%22$44,4254680.0%9$140,525
21148.9%20$45,2004620.0%10$145,775
2288.9%44$14,9504540.0%11$118,975
23153.3%17$43,1754280.0%12$92,550
2484.4%47$17,0254260.0%13$131,800
25130.5%23$32,5754133.3%14$140,700
2686.7%45$27,7754020.0%15$154,850
27104.4%33$22,9253940.0%16$98,725
28117.8%29$24,1753540.0%17$78,050
2997.8%41$43,3003520.0%18$127,500
3084.4%47$12,1503480.0%19$80,750
31102.2%34$27,3503220.0%20$61,725
32128.9%24$46,9753120.0%21$81,825
3384.4%47$23,3253100.0%22$68,175
34111.1%32$25,4252920.0%23$93,950
35102.2%34$39,3752920.0%23$62,650
36113.6%31$30,2752883.3%25$75,450
37194.4%12$22,2252860.0%26$49,250
3883.3%51$11,7502780.0%27$59,000
3981.0%52$2,6502766.7%28$47,775
4091.5%43$54,5252700.0%29$97,725
41166.7%14$23,6502660.0%30$83,975
42151.8%18$49,8002383.3%31$60,075
43118.6%28$35,2252283.3%32$55,725
4484.4%47$16,2752220.0%33$37,900
45100.0%36$5,0502180.0%34$36,775
4686.7%45$12,4752180.0%34$46,950
47280.0%1$25,9002140.0%36$154,300
48100.0%36$29,6501240.0%37$110,675
49260.0%2$13,2001200.0%38$78,875
50200.0%10$12,4251160.0%39$108,650
51220.0%7$33,550980.0%40$107,300
52100.0%36$20,500880.0%41$89,050
53100.0%36$17,100760.0%42$87,075
54260.0%2$14,650560.0%43$56,950
55260.0%2$12,750520.0%44$81,500
56220.0%7$8,350520.0%44$87,125
57160.0%16$26,325520.0%44$102,875
58120.0%25$26,075440.0%47$89,875
5980.0%53$17,000400.0%48$87,050
60140.0%21$19,850380.0%49$79,500
61100.0%36$27,925320.0%50$99,950
62120.0%25$10,950200.0%51$70,450
63231.1%6$39,425-n/an/a
64120.0%25$25,575-n/an/a
 
Upvote 0
Thanks for that.
How about
Fluff.xlsm
ABCD
1
2
3countResults
4Top 105£26,800
5Top 25%13£36,690
6Avg£30,054
7Bottom 25%13£20,667
8Bottom 10%5£14,200
9
10Total count53
11Jan Attn%Jan Attn% RankJan Earning
1297.20%4215,475
13244.40%567,500
14191.50%1378,300
15166.70%1456,875
16215.60%978,850
17151.10%1947,550
18195.60%1169,850
19115.60%3043,225
20137.80%2244,425
21148.90%2045,200
2288.90%4414,950
23153.30%1743,175
2484.40%4717,025
25130.50%2332,575
2686.70%4527,775
27104.40%3322,925
28117.80%2924,175
2997.80%4143,300
3084.40%4712,150
31102.20%3427,350
32128.90%2446,975
3384.40%4723,325
34111.10%3225,425
35102.20%3439,375
36113.60%3130,275
37194.40%1222,225
3883.30%5111,750
3981.00%522,650
4091.50%4354,525
41166.70%1423,650
42151.80%1849,800
43118.60%2835,225
4484.40%4716,275
45100.00%365,050
4686.70%4512,475
47280.00%125,900
48100.00%3629,650
49260.00%213,200
50200.00%1012,425
51220.00%733,550
52100.00%3620,500
53100.00%3617,100
54260.00%214,650
55260.00%212,750
56220.00%78,350
57160.00%1626,325
58120.00%2526,075
5980.00%5317,000
60140.00%2119,850
61100.00%3627,925
62120.00%2510,950
63231.10%639,425
64120.00%2525,575
Main
Cell Formulas
RangeFormula
D4:D8D4=LET(data,SORT(C12:D64),r,ROWS(data),VSTACK(AVERAGE(TAKE(data,r*0.1,-1)),AVERAGE(TAKE(data,r*0.25,-1)),AVERAGE(TAKE(data,,-1)),AVERAGE(TAKE(data,-r*0.25,-1)),AVERAGE(TAKE(data,-r*0.1,-1))))
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,707
Members
448,981
Latest member
recon11bucks

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