Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
G
 
Posts: n/a
Default Automatic Sort with VLOOKUP/LARGE Functions

I'm referencing a range and creating an automatically-sorted list using
VLOOKUP, sorting by the highest total sold. Here's my reference information:

Column A B C D E
Name Week 1 Week 2 Total Sold (helper)

Widget 1 3 3 6 =A3
Widget 2 2 3 5 =A4
Widget 3 2 3 5 =A5

Here's the code:
Column A Column B
=VLOOKUP(F2,D$3:E$5,2,FALSE) =LARGE(D$3:D$5,1)
=VLOOKUP(F3,D$3:E$5,2,FALSE) =LARGE(D$3:D$5,2)
=VLOOKUP(F4,D$3:E$5,2,FALSE) =LARGE(D$3:D$5,3)

My results are as follows:
Column F Column G
Widget 1 6
Widget 2 5
Widget 2 5

The problem is that WIDGET2 is referenced twice because the totals for
Widget 2 and Widget 3 are identical (5) and, apparently, the first referenced
field is displayed.

Can anyone show me how I can code this to DYNAMICALLY display the correct
sort order/fields?

Thanks.

Gary






  #2   Report Post  
Domenic
 
Posts: n/a
Default

Assumptions:

A3:A5 contains the name

D3:D5 contains the total sold


Formulas (confirmed with CONTROL+SHIFT+ENTER, not just ENTER):

F3, copied down:

=INDEX(A$3:A$5,MATCH(LARGE($D$3:$D$5-ROW($D$3:$D$5)/10^10,ROWS(F$3:F3)),$
D$3:$D$5-ROW($D$3:$D$5)/10^10,0))

G3, copied down:

=INDEX(D$3:D$5,MATCH(LARGE($D$3:$D$5-ROW($D$3:$D$5)/10^10,ROWS(G$3:G3)),$
D$3:$D$5-ROW($D$3:$D$5)/10^10,0))

Hope this helps!

In article ,
"G" wrote:

I'm referencing a range and creating an automatically-sorted list using
VLOOKUP, sorting by the highest total sold. Here's my reference information:

Column A B C D E
Name Week 1 Week 2 Total Sold (helper)

Widget 1 3 3 6 =A3
Widget 2 2 3 5 =A4
Widget 3 2 3 5 =A5

Here's the code:
Column A Column B
=VLOOKUP(F2,D$3:E$5,2,FALSE) =LARGE(D$3:D$5,1)
=VLOOKUP(F3,D$3:E$5,2,FALSE) =LARGE(D$3:D$5,2)
=VLOOKUP(F4,D$3:E$5,2,FALSE) =LARGE(D$3:D$5,3)

My results are as follows:
Column F Column G
Widget 1 6
Widget 2 5
Widget 2 5

The problem is that WIDGET2 is referenced twice because the totals for
Widget 2 and Widget 3 are identical (5) and, apparently, the first referenced
field is displayed.

Can anyone show me how I can code this to DYNAMICALLY display the correct
sort order/fields?

Thanks.

Gary

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
automatic sort Robert Excel Worksheet Functions 6 June 28th 05 02:28 PM
sorting more than 3 keys Brooke Excel Discussion (Misc queries) 3 June 18th 05 04:52 AM
"-" ignored in sort Mike H Excel Discussion (Misc queries) 8 January 2nd 05 07:48 AM
HELP! How do you--> Lock a set of rows but also link worksheets to FRUSTRATED Excel Discussion (Misc queries) 6 December 29th 04 10:05 PM
Automatic Page Sort The Boondock Saint Excel Worksheet Functions 1 December 6th 04 06:00 AM


All times are GMT +1. The time now is 11:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"