Formula to arrange rows in numerical order.

MrsFrankieH

Active Member
Joined
Mar 25, 2011
Messages
323
Office Version
  1. 365
Platform
  1. Windows
[TABLE="width: 165"]
<colgroup><col span="5"></colgroup><tbody>[TR]
[TD]3[/TD]
[TD]18[/TD]
[TD]30[/TD]
[TD]34[/TD]
[TD]42[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]5[/TD]
[TD]6[/TD]
[TD]31[/TD]
[TD]41[/TD]
[/TR]
[TR]
[TD]24[/TD]
[TD]26[/TD]
[TD]36[/TD]
[TD]40[/TD]
[TD]41[/TD]
[/TR]
[TR]
[TD]17[/TD]
[TD]19[/TD]
[TD]27[/TD]
[TD]33[/TD]
[TD]37[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]9[/TD]
[TD]26[/TD]
[TD]30[/TD]
[TD]36[/TD]
[/TR]
[TR]
[TD]18[/TD]
[TD]19[/TD]
[TD]25[/TD]
[TD]26[/TD]
[TD]32[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]17[/TD]
[TD]30[/TD]
[TD]35 [/TD]
[TD]
37
[/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="width: 165"]
<colgroup><col span="5"></colgroup><tbody>[TR]
[TD]1[/TD]
[TD]9[/TD]
[TD]26[/TD]
[TD]30[/TD]
[TD]36[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]18[/TD]
[TD]30[/TD]
[TD]34[/TD]
[TD]42[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]5[/TD]
[TD]6[/TD]
[TD]31[/TD]
[TD]41[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]17[/TD]
[TD]30[/TD]
[TD]35[/TD]
[TD]37[/TD]
[/TR]
[TR]
[TD]17[/TD]
[TD]19[/TD]
[TD]27[/TD]
[TD]33[/TD]
[TD]37[/TD]
[/TR]
[TR]
[TD]18[/TD]
[TD]19[/TD]
[TD]25[/TD]
[TD]26[/TD]
[TD]32[/TD]
[/TR]
[TR]
[TD]24[/TD]
[TD]26[/TD]
[TD]36[/TD]
[TD]40[/TD]
[TD]41[/TD]
[/TR]
</tbody>[/TABLE]

Hello Everyone!!

My computer is Dell and operating system is 10.

Can someone please help me with a formula to automatically arrange rows of numbers in numerical order? The top sets of numbers are how they look originally. The bottom sets are how I'd like them to look.

Thank you in advance. :)

Frankie x
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Re: Help with formula to arrange rows in numerical order.

Hello Frankie,

I'm assuming that the numbers are in Columns A:E starting in Row2 with headings in Row1 and that you are sorting on Column A values. If so, try this code:-

Code:
Sub SortIt()

Sheet1.Range("A2", Sheet1.Range("E" & Sheet1.Rows.Count).End(xlUp)).Sort Sheet1.[A2], 1

End Sub

Change the sheet references to suit yourself.

I hope that this helps.

Cheerio,
vcoolio.
 
Upvote 0
Re: Help with formula to arrange rows in numerical order.

Why not just use the inbuilt sort facility?
Just select your data & sort on the first column
 
Upvote 0
Re: Help with formula to arrange rows in numerical order.

Hello Vcoolio!!

First, thank you so much for the code. Unfortunately my aptitude isn't up to snuff for the code. Would you have a formula I can use? Thank you again!
Blessings.... <3
 
Upvote 0
Re: Help with formula to arrange rows in numerical order.

As Fluff said why not use inbuilt sort facility. (Excel - Data tab - Sort option). Thank you
 
Upvote 0
Re: Help with formula to arrange rows in numerical order.

Hello Fluff!
Thank you so much for your response. I did try the built in function, but unfortunately, it didn't produce the results I'm looking for.
Also, I had to post the examples one above the other. In an ideal scenerio, they would be side by side (horizonally).

Would you have a formula that can help?? Thanks again. Blessings! <3
 
Upvote 0
Re: Help with formula to arrange rows in numerical order.

Hello Sam! :)
As I told Fluff, I wasn't getting the reults I needed using the built in function.

Thank you so much for the comment. I really appreciate it. :)
 
Upvote 0
Re: Help with formula to arrange rows in numerical order.

Kindly dont say that, that is the easiest and safest way of sorting in excel without messing up your data.

Could you please explain us - how did you try doing it
 
Upvote 0
Re: Help with formula to arrange rows in numerical order.

@MrsFrankieH
In your original sample data, the 2nd column contains two numbers the same (19). Therefore I assume that is also possible with the first, or any other, column.
If that is possible, can you please post the expected result for this set of data, with any further clarification?
I have highlighted green where some rows have columns of equal values.

Excel Workbook
ABCDE
1318303442
21719273337
3318263036
41819252632
5318303437
Sort rows
 
Upvote 0
Re: Help with formula to arrange rows in numerical order.

Please ignore-
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,161
Members
453,021
Latest member
Justyna P

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