#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 115
Default Numerical Sorting

I have a numerical sorting issue with project numbers that sort as follows
(not in correct numerical order):

2008-01
2008-010
2008-0100
2008-02
2008-1
2008-2
2008-200
2008-3

The problem is that Excel sorts by the first number it sees - so 010 would
come before 1.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,856
Default Numerical Sorting

Can you arrange for those numbers after 2008- to have the same number
of digits, by adding leading zeros like this:

2008-0001
2008-0010
2008-0100
2008-0002
2008-0001
2008-0002
2008-0200
2008-0003

If so, then they would sort correctly.

You can put the leading zeros in using a formula like this:

=LEFT(A1,5)&TEXT(RIGHT(A1,LEN(A1)-5),"0000")

assuming the number is in A1 - copy down as required.

Hope this helps.

Pete


On Jan 9, 3:42*pm, Carol wrote:
I have a numerical sorting issue with project numbers that sort as follows
(not in correct numerical order):

2008-01
2008-010
2008-0100
2008-02
2008-1
2008-2
2008-200
2008-3

The problem is that Excel sorts by the first number it sees - so 010 would
come before 1.


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
Sorting by numerical value so that subjects follow al Excel Discussion (Misc queries) 1 August 20th 08 04:46 PM
Sorting Numbers with established numerical hiearchy Smedlynf Excel Discussion (Misc queries) 1 October 25th 07 09:16 PM
sorting numerical data ezil Excel Discussion (Misc queries) 2 August 21st 07 07:44 PM
sorting data using numerical list Lyns Excel Worksheet Functions 1 March 7th 07 06:13 AM
Sorting Numerical Values... Smohrman Excel Worksheet Functions 9 April 7th 06 07:58 AM


All times are GMT +1. The time now is 09:21 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"