sort numbers which have dashes

otwelmr

New Member
Joined
Jan 5, 2007
Messages
8
I need to be able to sort numbers of the following format:1-1,1-2,1-3,2-1,2-2,2-3,etc.
Excel is not happy with this. I first have to format the cell as text just to keep excel from reformatting my numbers as dates, but then it doesn't allow me to sort them correctly. Help me please.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
I used the numbers you listed and was able to sort them properly. Are you sure you don't have any spaces in any of the cells?
 
Upvote 0
no spaces, I have a series of 319 of these from 1-1 to 10-35, all with different quantities, when I try to sort, I get the message to sort all together or separate numbers and text. Regardless of which I choose, normally all together, it seems to jumble everything up.
 
Upvote 0
Since its text, Excel will always sort 10-35 before 1-2. Similarly, if you had 12-20 that would sort inbetween 1-2 and 2-15.

Trying using 2 helper columns with string functions to extract the left and right sides of the value, and sort the 3 columns by cols B and C
ColB: VALUE(MID(A1,1,FIND("-",A1)-1))
ColC: VALUE(MID($A1,FIND("-",$A1)+1,2))

Excel 2003 also has error an error checking option "Text Date with 2 Digit Years" you can disable to remove those ugly green triangles.
 
Upvote 0
Create a "Custom List" (Tools>Options>Custom List). Now you can sort using this list as the sort order.

lenze
 
Upvote 0

Forum statistics

Threads
1,216,004
Messages
6,128,223
Members
449,435
Latest member
Jahmia0616

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