Sort groups of cells into numerical order

jock444

New Member
Joined
Feb 13, 2019
Messages
9
Hi, I would appreciate any help on how to write some code to sort groups of cells I have into numerical order. The cells are grouped like this:

AB
11516
2green
3triangle
4
51112
6blue
7square
8
92021
10yellow
11diamond
12
1378
14red
15circle

<tbody>
</tbody>


The numbers are start and end times so I would like to sort the cells by the first number in each group (cells A1, A5, A9, A13 in my example) so the result should be this:

AB
178
2red
3circle
4
51112
6blue
7square
8
91516
10green
11triangle
12
132021
14yellow
15diamond

<tbody>
</tbody>


I'm new to coding so really not sure the best way of doing it. The groups of cells are all named ranges if that makes it simpler? Many thanks!
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
It can be with a formula and ordering the table.
For example, create an Auxiliary column and write the formula in C2 as shown in the following example, then copy down.


Book1
ABC
1DATA 1DATA 2AUX
2151615
3green15
4triangle15
515
6111211
7blue11
8square11
911
10202120
11yellow20
12diamond20
1320
14787
15red7
16circle7
Hoja4
Cell Formulas
RangeFormula
C2=IF(ISNUMBER(A2),A2,C1)


Now sort the table by the auxiliary column from lowest to highest


Book1
ABC
1DATA 1DATA 2AUX
2787
3red7
4circle7
5111211
6blue11
7square11
811
9151615
10green15
11triangle15
1215
13202120
14yellow20
15diamond20
1620
Hoja4
 
Upvote 0
Thanks Dante, that's a simple solution which should work well for what I need. Appreciate your help again :).
 
Upvote 0
I'm glad to help you. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,432
Members
448,961
Latest member
nzskater

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