Numerical order of cells

jswillcox

New Member
Joined
Dec 30, 2015
Messages
32
I have a question about automatically ordering cells.

I have cells that show as follows

A B
1 |Cinthia 12
2 |Scot 20
3 |Mike 5


I would like to make it so these cells automatically order by highest to lowest. This number changes daily and I have been ordering them using Sort Highest to lowest. The issue is I need to do that manually every day. How can I have excel order a select number of cells keeping cells a and b together.

How I would like it to order this example

A B
1 |Scot 20
2 |Cinthia 12
3 |Mike 5

I appreciate all your help!
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
I can think of 2 possible ways to do this.

First, you could create a Worksheet_Change event. It would monitor Column B, and any time a change was made, it would automatically sort columns A:B. I'm not sure how well that would work. It would depend on how your columns are populated. If you try to enter data and it's continually sorting, that could be an issue.

Second way would be to create 2 additional columns with formulas that automatically create a sorted list. For example:

ABCDE
1Cinthia12Scot20
2Scot20Cinthia12
3Mike5Joe12
4Joe12Mike5
5
6

<tbody>
</tbody>
Sheet4

Worksheet Formulas
CellFormula
E1=IFERROR(LARGE($B$1:$B$10,ROWS($E$1:$E1)),"")

<tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
D1{=IF(E1="","",INDEX(A:A,SMALL(IF($B$1:$B$10=E1,ROW($B$1:$B$10)),COUNTIF($E$1:$E1,E1))))}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>



The new columns are D and E. Enter the E1 formula first, then the D1 array formula. Change the ranges to match the maximum number of rows in your range. Copy down as far as needed.

Hope this helps.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,120
Members
451,399
Latest member
alchavar

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