How to populate and sort a table by the highest value in another table

cyberdimitri

New Member
Joined
Nov 4, 2012
Messages
49
Office Version
  1. 365
Platform
  1. Windows
I have a list of items in column A and the amount that was sold in a given period in column B.
How can I create another table, sorted by the item sold most to least?
In the example below, I want the table on D1 to have the items listed in the highest to lowest sell order.
1670326150963.png
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Like this?

22 12 06.xlsm
ABCDE
1
2Item 18Item 4654
3Item 265Item 6265
4Item 325Item 8145
5Item 4654Item 265
6Item 525Item 948
7Item 6265Item 325
8Item 725Item 525
9Item 8145Item 725
10Item 948Item 1025
11Item 1025Item 18
Sort by sold
Cell Formulas
RangeFormula
D2:E11D2=SORT(A2:B11,2,-1)
Dynamic array formulas.
 
Upvote 0
Solution
Power Query solution: Import first table, sort by SOLD, load as new table.
 
Upvote 0
Like this?

22 12 06.xlsm
ABCDE
1
2Item 18Item 4654
3Item 265Item 6265
4Item 325Item 8145
5Item 4654Item 265
6Item 525Item 948
7Item 6265Item 325
8Item 725Item 525
9Item 8145Item 725
10Item 948Item 1025
11Item 1025Item 18
Sort by sold
Cell Formulas
RangeFormula
D2:E11D2=SORT(A2:B11,2,-1)
Dynamic array formulas.
Thanks Peter, it worked!

But what if I make it a little more difficult?
Like in the example below?
1670336595609.png

Now there are 2 extra columns which I need to be omitted from the sorted table (F1:G11), I just need the 'ITEM' and the "SOLD' columns, sorted by SOLD. Is that possible?
 
Upvote 0
Power Query solution: Import first table, sort by SOLD, load as new table.
Thanks for your answer. I'm not sure how to do what you suggest, too much of a noob :)
EDIT: after googling "power query", I'm sure the solution is not for me, wayyy too complex.
Again, thanks for the answer!
 
Upvote 0
Thanks for your answer. I'm not sure how to do what you suggest, too much of a noob :)
EDIT: after googling "power query", I'm sure the solution is not for me, wayyy too complex.
Again, thanks for the answer!
First this:

1670339518496.png


To get this:

Book2
AB
1ITEMSOLD
2Item 18
3Item 265
4Item 325
5Item 4654
6Item 525
7Item 6265
8Item 725
9Item 8145
10Item 948
11Item 1025
Sheet1


Then this:

1670339613466.png


Then click here:

1670339669194.png


Choose "Sort Descending".

1670339713038.png


Close & Load To...

1670339828878.png


New Table in a new or existing worksheet.

1670339894432.png


And you're done! This method allows you to do all sorts of other useful operations on your data, without writing code at all.

Book2
AB
1ITEMSOLD
2Item 4654
3Item 6265
4Item 8145
5Item 265
6Item 948
7Item 725
8Item 525
9Item 325
10Item 1025
11Item 18
Table1
 
Upvote 0
Thanks Peter, it worked!

But what if I make it a little more difficult?
Like in the example below?
View attachment 80293
Now there are 2 extra columns which I need to be omitted from the sorted table (F1:G11), I just need the 'ITEM' and the "SOLD' columns, sorted by SOLD. Is that possible?
Power Query has a "Remove Columns" action for this.
 
Upvote 0
Now there are 2 extra columns which I need to be omitted from the sorted table (F1:G11), I just need the 'ITEM' and the "SOLD' columns, sorted by SOLD. Is that possible?
How about
Excel Formula:
=SORT(CHOOSECOLS(A2:D11,1,4),2,-1)

Power Query has a "Remove Columns" action for this.
But no need, a simple formula can do it far simpler. ;)
 
Upvote 0
How about
Excel Formula:
=SORT(CHOOSECOLS(A2:D11,1,4),2,-1)


But no need, a simple formula can do it far simpler. ;)

How is "SORT(CHOOSECOLS(A2:D11,1,4),2,-1)" simpler than "first sort, then remove columns not named ITEM and SOLD"?
 
Upvote 0

Forum statistics

Threads
1,215,084
Messages
6,123,028
Members
449,092
Latest member
ikke

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