# Thread: Formula to arrange rows in numerical order. Thanks: 0 Likes: 0

1. ## Formula to arrange rows in numerical order.

 3 18 30 34 42 4 5 6 31 41 24 26 36 40 41 17 19 27 33 37 1 9 26 30 36 18 19 25 26 32 11 17 30 35 37

 1 9 26 30 36 3 18 30 34 42 4 5 6 31 41 11 17 30 35 37 17 19 27 33 37 18 19 25 26 32 24 26 36 40 41

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.

Frankie x

2. ## 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.

3. ## 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

4. ## 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

5. ## 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

6. ## 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

7. ## 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.

8. ## 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

9. ## 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.

Sort rows

 A B C D E 1 3 18 30 34 42 2 17 19 27 33 37 3 3 18 26 30 36 4 18 19 25 26 32 5 3 18 30 34 37

Excel tables to the web >> Excel Jeanie HTML 4