How to calculate the top 5% of numbers within a category

kylerisi

Board Regular
Joined
Nov 1, 2015
Messages
93
Office Version
  1. 365
Platform
  1. Windows
Hi Team.

Can anyone please help me construct the following Formula.

In collum B I have the scores of a test that was taken by 100 students. In collum A is the college that each student belongs to, there are 10 colleges. All scores are in a random order, not sorted by rank or grouped by college, scores and the college are scattered randomly throughout my list in order that they were submitted.

I need a formula that I can enter into collum C which will calculate which scores for each college are in the top 20%, I need to do this without sorting my list.

Can this be done.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
What version of Excel are you using?...you can update your profile to show that.
 
Upvote 0
Let me know if this works...or if you have something else in mind. My mock-up extends down to row 103. The key steps are to find the 80th percentile of the scores (cell B1) and then use that value to test each score to find the ones that are >=...which is shown in D4 and down. If you'd like, you could extract just the top 20% and list them separately, but I'm not sure what you have in mind.
MrExcel_20220808.xlsx
ABCDE
186.4<--80th percentile20<--count
2
3SchoolScoreStudent NameTop 20% (shown as 1)
4E15610
5A5220
6C16930
7D5340
8B3850
9E5260
10D5170
11C7580
12E18690
13A181100
14C192111
15D93121
16B45130
17D51140
18B175150
19E56160
20B198171
Sheet3
Cell Formulas
RangeFormula
B1B1=PERCENTILE.INC(B4:B103,0.8)
D1D1=SUM(D4:D103)
D4:D20D4=--(B4>=$B$1)
 
Upvote 0
As an example, the single formula in the yellow cell will perform the percentile calculation, make the logical tests to determine which scores qualify, and then filter the results to extract the top 20% of scores and then sort them, first by school in ascending order, followed by score in descending order.
MrExcel_20220808.xlsx
ABCDEFGH
186.4<--80th percentile20<--count
2
3SchoolScoreStudent NameTop 20% (shown as 1)SchoolScoreStudent Name
4E15610A9195
5A5220A8898
6C16930A19943
7D5340A19064
8B3850B8942
9E5260B19817
10D5170B19845
11C7580C9962
12E18690C9972
13A181100C19211
14C192111C19157
15D93121C19167
16B45130D9312
17D51140D19422
18B175150D19060
19E56160E9776
20B198171E9561
21A46180E19731
22C33190E19034
Sheet3
Cell Formulas
RangeFormula
B1B1=PERCENTILE.INC(B4:B103,0.8)
D1D1=SUM(D4:D103)
F4:H23F4=SORT(FILTER(A4:C103,B4:B103>=PERCENTILE.INC(B4:B103,0.8)),{1,2},{1,-1})
D4:D22D4=--(B4>=$B$1)
Dynamic array formulas.
 
Upvote 0
I'm confused by the title of this thread and your first post. I've assumed you want the top 20% of scores when aggregating across all schools. The title mentions top 5% within a category. What are the categories?...is it top 20% or top 5%.
 
Upvote 0

Forum statistics

Threads
1,223,912
Messages
6,175,340
Members
452,638
Latest member
Oluwabukunmi

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