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