Excel Sort Numeric Column By Number

6

3

I have a column of integers in my spreadsheet, and the column is formatted as a number. Each cell inside the column is formatted as a number.

But I can't seem to sort them in numerical order - you know, 1,2...9,10,11...

Instead, it always sorts them according to text sorting : 10, 100, 101, 102...11, 111, 112, ....

How can I sort my column of numbers by number instead of by text?

rlb.usa

Posted 2011-10-04T21:00:54.970

Reputation: 1 430

This question exists, http://superuser.com/questions/218012/excel-pivot-table-how-to-sort-strings-as-numbers , however, it deals with pivot tables and the answer is to create another column with numbers. But the column in my spreadsheet is already converted to number format.

– rlb.usa – 2011-10-04T21:02:25.840

What version of excel, this worked for me in Excel 2007 – Nick Josevski – 2011-10-04T21:51:33.373

It is Excel 2010 – rlb.usa – 2011-10-04T22:04:30.450

Answers

8

It sounds as if your numbers are being interpreted as text by Excel. A good indication of this is that they automatically align to the left of each cell. Numbers normally are aligned to the right.

If this is the case, a simple fix is to move into a cell, press F2 then Enter. Repeat for each cell containing the numbers that don't sort. This works by putting the cell into edit mode and then out again. If the contents can be interpreted as a number then Excel converts it to a number.

If you have too many cells to do this manually, you can use the VALUE function to create another column contain true numeric values and then paste them (by value) back over the offending cells.

Mike Fitzpatrick

Posted 2011-10-04T21:00:54.970

Reputation: 15 062

1There is another catch, checkbox that says 'My data has headers' which has to be unchecked before sorting – Xinus – 2013-01-06T11:48:19.110

2

I know this is an old post, but since it's at the top of the search results for this kind of thing...

There's a much easier way to do this. To convert numbers stored as text to numbers:

  1. Select the whole column.
  2. On the Data tab, click the Text to Columns button.
  3. On the wizard that opens, just go ahead and click Finish. You don't need to go through the extra steps since they're for if you want to split columns.

And presto! Your column is now formatted as actual numbers and you should be able to sort smallest to largest instead of A to Z.

wjglenn

Posted 2011-10-04T21:00:54.970

Reputation: 21

2

You can do this on the data directly in a single shot by without creating working columns. My favoured method is using Paste Special (I normal multiply by the "text" by 1)

Debra Dalgleish provides 7 methods here, http://www.contextures.com/xlDataEntry03.html

The Paste Special method as listed by Debra is

  • Select a blank cell
  • Choose Edit > Copy
  • Select the cells that contain the numbers
  • Choose Edit > Paste Special
  • Select Add
  • Click OK
  • To apply number formatting, choose Format > Cells
  • On the Number tab, select the appropriate format, then click OK

brettdj

Posted 2011-10-04T21:00:54.970

Reputation: 1 912

Doesn't help, they are already formatted as numbers – rlb.usa – 2011-10-04T22:01:34.217

1Although Pasting and then using one of the paste options that comes up to paste as a number does work – rlb.usa – 2011-10-04T22:07:49.650

Yes, its the Paste Special operation that forces the convert. Glad to hear you got it working. – brettdj – 2011-10-04T22:15:17.217

1

I did all of them . But did not help.. My solution was just multiply it with 1 to the next cell. Copy and special past multipled cell to next cell. delete old 2 cells

user568983

Posted 2011-10-04T21:00:54.970

Reputation: 11

0

I am new at this but I just figured out something, maybe it will help.

I was sorting something on my Excel file which has number of days and I needed to sort them by days.

This sort the column in sequence like 1, 100, 102, 2, 201, 203, 3, 205, ...

The solution: using Sort and Filters.

  1. Format the cells to make sure that they are all numbers. If they have prefix or suffix make sure you remove them as well. In my case I had "days" as suffixes. To remove it you can do a =LEFT(A1, LEN(A1)- number of letters you want to remove), change A1 to appropriate cell.

  2. Highlight all the cells in the column and format the cells to be a number.

  3. When you do a filter it should show as a number filters instead of a text filter.

  4. Filter it by value of number instead of A-Z.

Click here to see image of Number Filters

Ariestotle Viduya

Posted 2011-10-04T21:00:54.970

Reputation: 1

0

Change the format of the cell to =TEXT(A1,"#0"), this will arrange it properly.

Ramzilla

Posted 2011-10-04T21:00:54.970

Reputation: 1

This seems to be the opposite of what the question asks. – RalfFriedl – 2018-10-11T07:21:30.813

Welcome to Superuser:- Your answer can be useful to other readers that the accepted answer did not work for but requires detail and a working answer to the question. Please take a couple of minutes and read:- [help] .Answering: [answer], again welcome to superuser and i hope you keep coming back.Thankyou – mic84 – 2018-10-11T09:14:57.917

0

Just change your single digits (1,2,3,etc.) to 01, 02, 03. Then sort A to Z.

Jake

Posted 2011-10-04T21:00:54.970

Reputation: 1

1Welcome to Super User! I know you are new to this site, but wanted to make you aware you are posting an answer to a 4-year old question that has an excepted answer already. There is nothing wrong with doing so, just realize it may not be responded to or accepted. – CharlieRB – 2015-06-30T18:31:11.983

-1

I have the same problem but finally resolve it after a couple of tries and failures. The best solution I found when sorting numbers in a database that contains number like 1,2,3...10,11,12,13....NC,CAR, 4-A,4-B...etc. Ordinarily if your database contains numbers like above example, if you sort them out it will sort like this 1,10,11,2,3,5,6,7,8,9,4-A,4-B...etc whatever the combination of alpha-numeric number...the solution is simple. First be sure to point your mouse and select the column you want to sort out then.. Create a custom list...in the Home tab of MS Excel, click Sort & Filter, choose Custom Sort, you will see 3 options on how your sort will come about(Column, Sort On, Order),choose Order drop down menu, set custom lists, add or input/type your sorting format in the lists entries, then voila there it is, a custom sort format of your desire. The next time to sort your database just use the custom list you have put. I am using an MS Excel 2010 version. Hope this helps to fellow soldiers battling problems in the world of the spreadsheet.:)

gypsydawg

Posted 2011-10-04T21:00:54.970

Reputation: 1