Reputation: 1
When I try to sort a column, the sorting isn't exactly right. The content in the column contains text and numbers.
Here's an excel file where the ordering is wrong: https://www.dropbox.com/s/grbg0ic2r5fylpw/sample.xls?dl=0
Can someone help me fix the problem?
Thanks
Upvotes: 0
Views: 58
Reputation: 60379
If this will need to be done repetitively, record a macro while you do these steps, then edit the macro to recognize the appropriate ranges automatically.
Upvotes: 0
Reputation: 152605
Excel sorts text fields Character by Character so text wise "11" come before "2". So you need to add leading 0
to the numbers. "002" comes before "011"
To do that:
In an empty column put the following formula in the first row:
=LEFT(A1,SEARCH("}}}",SUBSTITUTE(A1," ","}}}",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))) & TEXT(--TRIM(MID(A1,SEARCH("}}}",SUBSTITUTE(A1," ","}}}",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))),999)),"000")
Then copy down.
Then copy the new column and paste just the values on the old column. Then your sort should work.
If you want to keep the original formatting then leave the new column and sort on the new column instead. You can hide the new column.
Upvotes: 1
Reputation: 1
Seem like there are some formatting issues in the data. I selected all your data, opened a new spreadsheet, copied and clicked on paste special. I choose values and numbers. This brings back the data without any formatting in them. I was then able to sort this properly.
Upvotes: 0