You are here:

# Excel/excel sort numbers with dashes

Question
Hi,
I have a chart in which I put revenue administrative bulleting (RAB) numbers in column A in the following format:  1980-1, 1980-2 and so on.  In column B I list the type of tax that the RAB pertains to, ex. IIT, CIT, etc.  I have sorted the sheet on 2 levels: I have instructed it to first sort column B alphabetically by the first 3 characters, which groups each tax type together--no problems there.  Then I want to sort column A as the next level so that within each tax type group I have sorted by the year and then the number of the RAB within that year in chronological order.  so, for example, it should be sorting as 1980-1, 1980-2, etc.  The problem is excel sorts digit by digit and so after the double digits come in such as 1980-12, it perceived that to come before 1980-9.  I read that you can change the cell format to text but it doesn't seem to help.  Maybe because I have 2 levels of sorting already.  I am not too good with formulas (someone had to help me with the column B alphabetic sort to limit it to first 3 characters).  Any advice you can give is great.  I use excel 2010.  my address is jensenj at michigan dot gov.  Thank you.

Julie,

You are correct.  The data you show is text.  It is sorted as text.  Text is sorted character by character so the 1 in the 1980-12 is compared to the 9 in 1980-9  (referring to the 6th character in each).

The easiest solution would be to change

1980-9 to 1980-09

either by doing it manually in place or using a formula to do it and then sorting on the column with the formula.

--
Regards,
Tom Ogilvy

Questioner's Rating
 Rating(1-10) Knowledgeability = 10 Clarity of Response = 10 Politeness = 10 Comment Thanks so much for your quick and clear response. What a great service.

This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

#### Tom Ogilvy

##### Expertise

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

##### Experience

Extensive experience.

Education/Credentials
Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.