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

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

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
1AgentJanuaryFebruaryMarchAprilMay3
2Al4001005050may
3Ben50020075100752
4Chris60030010040070agentsales
5Dan40010080100Ben75
6Chris70
7
8

<tbody>
</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,214,979
Messages
6,122,550
Members
449,088
Latest member
davidcom

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