Top 10 Extract

Matt

Board Regular
Joined
Feb 16, 2002
Messages
212
I have a list of 50 or so products along with the units sold in the adjacent column. I would like to list the top 10 products along with the units sold at the bottom of this list. Can anyone help me with the code for this?

thanks

Matt
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Have you tried using the RANK worksheet function and then extract the top 10 or sort on the returned ranks?
This message was edited by Mark W. on 2002-03-04 07:12
 
Upvote 0
On 2002-03-04 05:13, Matt wrote:
I have a list of 50 or so products along with the units sold in the adjacent column. I would like to list the top 10 products along with the units sold at the bottom of this list. Can anyone help me with the code for this?

thanks

Matt

Consider the following small sample in A1:B4.

{"p1",20;"p2",20;"p3",30;"p4",15}

In C1 enter:

=RANK(B1,$B$1:$B$4,1)+COUNTIF($B$1:B1,B1)-1

Copy down this as far as needed.

In A53 enter:

=INDEX($A$1:$A$4,MATCH(LARGE($C$1:$C$4,ROW()-52),$C$1:$C$4,0))

Notice 52 in the formula, which is the number of rows before the cell of this formula!

In B53 enter:

=INDEX($B$1:$B$4,MATCH(LARGE($C$1:$C$4,ROW()-52),$C$1:$C$4,0))

Select A53:B53 and copy down the last two formulas as far as needed: In your case, 10 rows down.

Aladin
 
Upvote 0

Forum statistics

Threads
1,223,365
Messages
6,171,654
Members
452,415
Latest member
mansoorali

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