Finding column title and returning row values in descending order (top 10)

lentel26

New Member
Joined
Feb 25, 2011
Messages
2
Hi All,

I appreciate the future input, I'm a bit stuck at the moment using index/match! I'm looking to create a drop down that contains all of the months (January, February, etc.)

Based on this drop down selection (i.e. February), I need the formula to pull out the top 10 sales values in descending order with the agent who sold it. Here's an example of my spreadsheet:

A B C D E F
1 Agent January February March April (cont'd)
2 Al 400 100 50 50
3 Ben 500 200 75 100
4 Chris 600 300 100 400

The person selects February in the dropdown and the spreadsheet returns in descending order:
Chris 300
Ben 200
Al 100

Thank you again for the help!
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Book1
ABCDEFGHI
1AgentJanuaryFebruaryMarchAprilMay3
2Al4001005050may
3Ben50020075100752
4Chris60030010040070agentsales
5Dan40010080100Ben75
6Chris70
7
8
Sheet1


H1: 3 (Top N; set N to suit)

H2: may (a dropdown month selection)

In H3 enter:

=COUNTIFS(INDEX($B$2:$F$5,0,MATCH(H$2,$B$1:$F$1,0)),">="&LARGE(INDEX($B$2:$F$5,0,MATCH(H$2,$B$1:$F$1,0)),MIN(H$1,COUNT(INDEX($B$2:$F$5,0,MATCH(H$2,$B$1:$F$1,0))))))

This adjusts Top N to suit the data.

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

=IF($I5="","",INDEX($A$2:$A$5,SMALL(IF(INDEX($B$2:$F$5,0,MATCH(H$2,$B$1:$F$1,0))=$I5,ROW($A$2:$A$5)-ROW($A$2)+1),COUNTIFS($I$5:I5,I5))))

In I5 enter and copy down:

=IF(ROWS($I$5:I5)>H$3,"",LARGE(INDEX($B$2:$F$5,0,MATCH(H$2,$B$1:$F$1,0)),ROWS($I$5:I5)))
 
Upvote 0
Awesome, this works perfect!! Thank you so much!

ABCDEFGHI
AgentJanuaryFebruaryMarchAprilMay
Almay
Ben
Chrisagentsales
DanBen
Chris

<tbody>
[TD="align: center"]1[/TD]

[TD="align: right"][/TD]
[TD="align: right"]3[/TD]
[TD="align: right"][/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]400[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]500[/TD]
[TD="align: right"]200[/TD]
[TD="align: right"]75[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]75[/TD]
[TD="align: right"][/TD]
[TD="align: right"]2[/TD]
[TD="align: right"][/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]600[/TD]
[TD="align: right"]300[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]400[/TD]
[TD="align: right"]70[/TD]
[TD="align: right"][/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]400[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]80[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]75[/TD]

[TD="align: center"]6[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]70[/TD]

[TD="align: center"]7[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]8[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Sheet1

H1: 3 (Top N; set N to suit)

H2: may (a dropdown month selection)

In H3 enter:

=COUNTIFS(INDEX($B$2:$F$5,0,MATCH(H$2,$B$1:$F$1,0)),">="&LARGE(INDEX($B$2:$F$5,0,MATCH(H$2,$B$1:$F$1,0)),MIN(H$1,COUNT(INDEX($B$2:$F$5,0,MATCH(H$2,$B$1:$F$1,0))))))

This adjusts Top N to suit the data.

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

=IF($I5="","",INDEX($A$2:$A$5,SMALL(IF(INDEX($B$2:$F$5,0,MATCH(H$2,$B$1:$F$1,0))=$I5,ROW($A$2:$A$5)-ROW($A$2)+1),COUNTIFS($I$5:I5,I5))))

In I5 enter and copy down:

=IF(ROWS($I$5:I5)>H$3,"",LARGE(INDEX($B$2:$F$5,0,MATCH(H$2,$B$1:$F$1,0)),ROWS($I$5:I5)))
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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