Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
l smith
 
Posts: n/a
Default sort numbers leading zeros

I am having trouble sorting a column of id numbers because some of them
contain leading zeroes. Excel doesn't recognize that no matter how I format
the cells. Help!

LS
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

Are all your id numbers numeric (no alpha characters in them at all)?

If you put:
=counta(A2:Axxx)
in an empty cell
and
=count(a2:axxx)

(adjust the range to match your data)

Do you get the same answer?

If no, then some of the values are stored as text and some(?) are stored as
numbers.

You can convert them all to numbers by:
selecting an empty cell
copy it
select your range of id's
edit|Paste special|Add

Format the cells the way you want:
format|cells|number tab|custom category
0000000

(to show leading 0's.)

Then your data should sort ok.

============
On the other hand, if your id's can look like:

12345
A1234
1234B

More work would be required.

l smith wrote:

I am having trouble sorting a column of id numbers because some of them
contain leading zeroes. Excel doesn't recognize that no matter how I format
the cells. Help!

LS


--

Dave Peterson
  #3   Report Post  
Anki
 
Posts: n/a
Default

Hi LS,

As Dave said, it depends on whether your ids carry characters. If they are
all numbers, then another alternative is to create a new column using Value
function. For example, if column A contains the original ids: A1 = 00085, in
the new column B, B1, set the function =value(A1) will return 85 as a number.
Then sort column B instead of column A.

Anki

"l smith" wrote:

I am having trouble sorting a column of id numbers because some of them
contain leading zeroes. Excel doesn't recognize that no matter how I format
the cells. Help!

LS

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I sort letters before numbers in Excel? RiverGirl Excel Discussion (Misc queries) 4 May 27th 05 04:09 PM
Numbers won't sort correctly. FernW Excel Discussion (Misc queries) 10 April 1st 05 01:29 PM
Numbers won't sort correctly. FernW Excel Discussion (Misc queries) 1 March 3rd 05 02:46 PM
Leading zeros JC Excel Discussion (Misc queries) 9 February 1st 05 02:33 PM
Displaying leading zeros in an Excel spreadsheet marianthelibrarian Excel Discussion (Misc queries) 1 January 25th 05 02:08 PM


All times are GMT +1. The time now is 09:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"