ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   sorting numbers with hyphens in excel (https://www.excelbanter.com/excel-discussion-misc-queries/259980-sorting-numbers-hyphens-excel.html)

mb-76

sorting numbers with hyphens in excel
 
I am trying to sort a list of numbers, some of which contain hyphens. For
example I want to sort "65,66,66-1,67-1,68,69". Excel sorts it out as
"65,66,68,69,66-1,67-1". What I want it to give me is
"65,66,66-1,67-1,68,69". Any ideas on how to do this in a simple manner? I
have had some ideas thrown at me but they are all rather involved and I would
like to be able to sort in this manner often. Thanks.

Luke M[_4_]

sorting numbers with hyphens in excel
 
First, convert all your data to text. Various ways of doing this, a quick
way is to use the formula:
=TEXT(A1,"@")
and then do a copy, paste special - values
Next, select your data, sort, ascending, and choose "sort numbers as text"
option. Otherwise, XL will sort all the numbers first, and then all the text
strings.

--
Best Regards,

Luke M
"mb-76" wrote in message
...
I am trying to sort a list of numbers, some of which contain hyphens. For
example I want to sort "65,66,66-1,67-1,68,69". Excel sorts it out as
"65,66,68,69,66-1,67-1". What I want it to give me is
"65,66,66-1,67-1,68,69". Any ideas on how to do this in a simple manner?
I
have had some ideas thrown at me but they are all rather involved and I
would
like to be able to sort in this manner often. Thanks.





All times are GMT +1. The time now is 07:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com