Top 10 Formula Help

Scotster

Board Regular
Joined
May 29, 2017
Messages
54
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi there,

I cannot for the life of me figure out how to go about extracting a top 10 table from a varying dataset. Any help would be appreciated.

Say I have the following:

Vendor TRT
Vendor1 10
Vendor2 12
Vendor6 36
Vendor3 13
Vendor1 42
Vendor4 15
Vendor6 18
Vendor4 23
Vendor2 32
Vendor3 30
Vendor1 18
Vendor2 7
Vendor3 7
Vendor4 18
Vendor5 12
Vendor6 30
Vendor7 41
Vendor8 19
Vendor9 50
Vendor10 75

How do I get the top 5 unique vendors based on TRT?

Many thanks :)
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hello,

Have you tried to insert a Pivot table ... and use the Top 10 feature ...?
 
Upvote 0
Hello,

Have you tried to insert a Pivot table ... and use the Top 10 feature ...?

I have yes, I was hoping for a more elegant solution though as I would rather have a static table for the report, programmatically generating the table to begin with using VBA. I realise that I could do the same by inserting a pivot table, copying the data, pasting values and then re-formatting but I would rather do it with a formula if possible.

I always love a formula challenge also :)
 
Upvote 0
Top 5 highest averages?

No, the unique top 5 Vendors with the highest average. In my example the results would be....

1. Vendor 10 - 75
2. Vendor 9 - 50
3. Vendor 7 - 41
4. Vendor 6 - 28
5. Vendor 1 - 23
 
Upvote 0
No, the unique top 5 Vendors with the highest average. In my example the results would be....

1. Vendor 10 - 75
2. Vendor 9 - 50
3. Vendor 7 - 41
4. Vendor 6 - 28
5. Vendor 1 - 23

That's actually yes...:)


Book1
ABCDEFG
1VendorTRTAVG5
2Vendor110235
3Vendor21217
4Vendor63628VENDORAVG TRT
5Vendor31317Vendor1075
6Vendor142Vendor950
7Vendor41519Vendor741
8Vendor618Vendor628
9Vendor423Vendor123.33333333
10Vendor232
11Vendor330
12Vendor118
13Vendor27
14Vendor37
15Vendor418
16Vendor51212
17Vendor630
18Vendor74141
19Vendor81919
20Vendor95050
21Vendor107575
Sheet1


In C2 just enter and copy down:

=IF(COUNTIFS($A$2:A2,A2)=1,AVERAGEIFS($B$2:$B$21,$A$2:$A$21,A2),"")

In F1 enter: 5 (Top 5)

In F2 just enter:

=COUNTIFS($C$2:$C$21,">="&LARGE($C$2:$C$21,MIN(F1,COUNT($C$2:$C$21))))

in order to adjust Top 5 for possible ties.

In F5 control+shift+enter, not just enter, and copy down:

=IF($G5="","",INDEX($A$2:$A$21,SMALL(IF($C$2:$C$21=$G5,ROW($A$2:$A$21)-ROW($A$2)+1),COUNTIFS($G$5:G5,G5))))

In G5 just enter and copy down:

=IF(ROWS($G$5:G5)>$F$2,"",LARGE($C$2:$C$21,ROWS($G$5:G5)))
 
Upvote 0
Great solution, very well thought out. Thanks for that :)
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,094
Latest member
teemeren

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