Generating a list ranked by value

Patrick020

New Member
Joined
Mar 20, 2018
Messages
15
Hi everyone

I have a table in A1:D9 in which a unit is plotted for each person against various locations.

Cell G1 is a data validation/drop down in which you can select a person from the table (in the example below I have taken Person 2). The formula therefore needs to reference cell G1.

I would like a formula to drag down from G2 which lists the locations for that person from the highest ranked to the lowest ranked. In the example below New York has a 12 for Person 2 which is the highest value – hence NewYork is listed first.

If possible I would also like a formula to drag down from F2which pulls the unit associated with that person and location – so in the example below F2 is 12 as Person 2 plots 12 for New York.

[TABLE="class: MsoTableGrid"]
<tbody>[TR]
[TD="width: 64, bgcolor: transparent"][/TD]
[TD="width: 104, bgcolor: transparent"] A<o:p></o:p>
[/TD]
[TD="width: 79, bgcolor: transparent"] B<o:p></o:p>
[/TD]
[TD="width: 75, bgcolor: transparent"] C<o:p></o:p>
[/TD]
[TD="width: 75, bgcolor: transparent"] D<o:p></o:p>
[/TD]
[TD="width: 65, bgcolor: transparent"] E<o:p></o:p>
[/TD]
[TD="width: 65, bgcolor: transparent"] F<o:p></o:p>
[/TD]
[TD="width: 98, bgcolor: transparent"] G<o:p></o:p>
[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"] 1<o:p></o:p>
[/TD]
[TD="width: 104, bgcolor: transparent"] City<o:p></o:p>
[/TD]
[TD="width: 79, bgcolor: transparent"] Person 1 <o:p></o:p>
[/TD]
[TD="width: 75, bgcolor: transparent"] Person 2<o:p></o:p>
[/TD]
[TD="width: 75, bgcolor: transparent"] Person 3<o:p></o:p>
[/TD]
[TD="width: 65, bgcolor: transparent"][/TD]
[TD="width: 65, bgcolor: transparent"] Unit <o:p></o:p>
[/TD]
[TD="width: 98, bgcolor: transparent"] Person 2<o:p></o:p>
[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"] 2<o:p></o:p>
[/TD]
[TD="width: 104, bgcolor: transparent"] Berlin <o:p></o:p>
[/TD]
[TD="width: 79, bgcolor: transparent"][/TD]
[TD="width: 75, bgcolor: transparent"][/TD]
[TD="width: 75, bgcolor: transparent"] 6<o:p></o:p>
[/TD]
[TD="width: 65, bgcolor: transparent"][/TD]
[TD="width: 65, bgcolor: transparent"] 12<o:p></o:p>
[/TD]
[TD="width: 98, bgcolor: transparent"] New York<o:p></o:p>
[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"] 3<o:p></o:p>
[/TD]
[TD="width: 104, bgcolor: transparent"] Los Angeles<o:p></o:p>
[/TD]
[TD="width: 79, bgcolor: transparent"] 3<o:p></o:p>
[/TD]
[TD="width: 75, bgcolor: transparent"] 3<o:p></o:p>
[/TD]
[TD="width: 75, bgcolor: transparent"][/TD]
[TD="width: 65, bgcolor: transparent"][/TD]
[TD="width: 65, bgcolor: transparent"] 7<o:p></o:p>
[/TD]
[TD="width: 98, bgcolor: transparent"] Paris <o:p></o:p>
[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"] 4<o:p></o:p>
[/TD]
[TD="width: 104, bgcolor: transparent"] London <o:p></o:p>
[/TD]
[TD="width: 79, bgcolor: transparent"] 8<o:p></o:p>
[/TD]
[TD="width: 75, bgcolor: transparent"][/TD]
[TD="width: 75, bgcolor: transparent"][/TD]
[TD="width: 65, bgcolor: transparent"][/TD]
[TD="width: 65, bgcolor: transparent"] 3<o:p></o:p>
[/TD]
[TD="width: 98, bgcolor: transparent"] Los Angeles <o:p></o:p>
[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"] 5<o:p></o:p>
[/TD]
[TD="width: 104, bgcolor: transparent"] Madrid <o:p></o:p>
[/TD]
[TD="width: 79, bgcolor: transparent"][/TD]
[TD="width: 75, bgcolor: transparent"] 1<o:p></o:p>
[/TD]
[TD="width: 75, bgcolor: transparent"][/TD]
[TD="width: 65, bgcolor: transparent"][/TD]
[TD="width: 65, bgcolor: transparent"] 1<o:p></o:p>
[/TD]
[TD="width: 98, bgcolor: transparent"] Madrid<o:p></o:p>
[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"] 6<o:p></o:p>
[/TD]
[TD="width: 104, bgcolor: transparent"] Moscow <o:p></o:p>
[/TD]
[TD="width: 79, bgcolor: transparent"][/TD]
[TD="width: 75, bgcolor: transparent"][/TD]
[TD="width: 75, bgcolor: transparent"] 2<o:p></o:p>
[/TD]
[TD="width: 65, bgcolor: transparent"][/TD]
[TD="width: 65, bgcolor: transparent"] <o:p> </o:p>
[/TD]
[TD="width: 98, bgcolor: transparent"] <o:p> </o:p>
[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"] 7<o:p></o:p>
[/TD]
[TD="width: 104, bgcolor: transparent"] New York <o:p></o:p>
[/TD]
[TD="width: 79, bgcolor: transparent"] 5<o:p></o:p>
[/TD]
[TD="width: 75, bgcolor: transparent"] 12<o:p></o:p>
[/TD]
[TD="width: 75, bgcolor: transparent"][/TD]
[TD="width: 65, bgcolor: transparent"][/TD]
[TD="width: 65, bgcolor: transparent"] <o:p> </o:p>
[/TD]
[TD="width: 98, bgcolor: transparent"] <o:p> </o:p>
[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"] 8<o:p></o:p>
[/TD]
[TD="width: 104, bgcolor: transparent"] Paris <o:p></o:p>
[/TD]
[TD="width: 79, bgcolor: transparent"][/TD]
[TD="width: 75, bgcolor: transparent"] 7<o:p></o:p>
[/TD]
[TD="width: 75, bgcolor: transparent"][/TD]
[TD="width: 65, bgcolor: transparent"][/TD]
[TD="width: 65, bgcolor: transparent"] <o:p> </o:p>
[/TD]
[TD="width: 98, bgcolor: transparent"] <o:p> </o:p>
[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"] 9<o:p></o:p>
[/TD]
[TD="width: 104, bgcolor: transparent"] Rome<o:p></o:p>
[/TD]
[TD="width: 79, bgcolor: transparent"][/TD]
[TD="width: 75, bgcolor: transparent"][/TD]
[TD="width: 75, bgcolor: transparent"] 11<o:p></o:p>
[/TD]
[TD="width: 65, bgcolor: transparent"][/TD]
[TD="width: 65, bgcolor: transparent"] <o:p> </o:p>
[/TD]
[TD="width: 98, bgcolor: transparent"] <o:p> </o:p>
[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"] 10<o:p></o:p>
[/TD]
[TD="width: 104, bgcolor: transparent"][/TD]
[TD="width: 79, bgcolor: transparent"][/TD]
[TD="width: 75, bgcolor: transparent"][/TD]
[TD="width: 75, bgcolor: transparent"][/TD]
[TD="width: 65, bgcolor: transparent"][/TD]
[TD="width: 65, bgcolor: transparent"] <o:p> </o:p>
[/TD]
[TD="width: 98, bgcolor: transparent"] <o:p> </o:p>
[/TD]
[/TR]
</tbody>[/TABLE]

Hopefully that is fairly clear but let me know if not!

Thanks
Patrick
 
Last edited by a moderator:

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Try

Formula in F2 copied down
=IFERROR(LARGE(INDEX(B$2:D$100,0,MATCH(G$1,B$1:D$1,0)),ROWS(F$2:F2)),"")

Array formula in G2 copied down
=IF(F2="","",INDEX(A$2:A$100,SMALL(IF(INDEX(B$2:D$100,0,MATCH(G$1,B$1:D$1,0))=F2,ROW(A$2:A$100)-ROW(A$2)+1),COUNTIF(F$2:F2,F2))))
confirmed with Ctrl+Shift+Enter, not just Enter

Hope this helps

M.
 
Upvote 0
similar approach


Excel 2013/2016
ABCDEFG
1CityPerson 1Person 2Person 3UnitPerson 2
2Berlin612New York
3Los Angeles337Paris
4London83Los Angeles
5Madrid11Madrid
6Moscow2
7New York512
8Paris7
9Rome11
Sheet1
Cell Formulas
RangeFormula
F2=LARGE(INDEX(A:D,,MATCH(G$1,$A$1:$D$1,0)),ROW(A2)-ROW($A$1))
G2=INDEX(A:A,MATCH(F2,INDEX(A:C,,MATCH(G$1,$A$1:$D$1,0)),0))
 
Upvote 0
Hi Alan

Thoughts:
1. I think there a typo in your formula in G2
=INDEX(A:A,MATCH(F2,INDEX(A:C,,MATCH(G$1,$A$1:$D$1,0)),0))
Shouldn't it be?
=INDEX(A:A,MATCH(F2,INDEX(A:D,,MATCH(G$1,$A$1:$D$1,0)),0))

2. To deal with draws is necessary an array formula in G2
For example: change the value in C8 to 12 (instead of 7)

M.
 
Last edited:
Upvote 0
Hi Alan

Thoughts:
1. I think there a typo in your formula in G2
=INDEX(A:A,MATCH(F2,INDEX(A:C,,MATCH(G$1,$A$1:$D$1,0)),0))
Shouldn't it be?
=INDEX(A:A,MATCH(F2,INDEX(A:D,,MATCH(G$1,$A$1:$D$1,0)),0))

2. To deal with draws is necessary an array formula in G2
For example: change the value in C8 to 12 (instead of 7)

M.

yes, you're right.
thanks
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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