Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
roger_home
 
Posts: n/a
Default Sort by numbers problem


My company has a 3 or 4 digit job number on all its jobs (i.e., 872,
944, 1015)...when I do a sort by number, all is fine. But occasionally
we add a A or a X to the end of the number (i.e., 772A, 1001X). Now
when I do a sort by number, these go the the bottom. Any way to keep
them in order by number?


--
roger_home
------------------------------------------------------------------------
roger_home's Profile: http://www.excelforum.com/member.php...o&userid=16434
View this thread: http://www.excelforum.com/showthread...hreadid=385270

  #2   Report Post  
Barb R.
 
Posts: n/a
Default

The values with a character at the end are being sorted as TEXT, not numbers.
The only way I could get it to work was to include a ' before the number.
I'm sure there's a more elegant way.

"roger_home" wrote:


My company has a 3 or 4 digit job number on all its jobs (i.e., 872,
944, 1015)...when I do a sort by number, all is fine. But occasionally
we add a A or a X to the end of the number (i.e., 772A, 1001X). Now
when I do a sort by number, these go the the bottom. Any way to keep
them in order by number?


--
roger_home
------------------------------------------------------------------------
roger_home's Profile: http://www.excelforum.com/member.php...o&userid=16434
View this thread: http://www.excelforum.com/showthread...hreadid=385270


  #3   Report Post  
Barb R.
 
Posts: n/a
Default

Alternatively, format the column with the job numbers as text first and enter
the numbers. Again, I'm sure there's a more elegant way out there.

"roger_home" wrote:


My company has a 3 or 4 digit job number on all its jobs (i.e., 872,
944, 1015)...when I do a sort by number, all is fine. But occasionally
we add a A or a X to the end of the number (i.e., 772A, 1001X). Now
when I do a sort by number, these go the the bottom. Any way to keep
them in order by number?


--
roger_home
------------------------------------------------------------------------
roger_home's Profile: http://www.excelforum.com/member.php...o&userid=16434
View this thread: http://www.excelforum.com/showthread...hreadid=385270


  #4   Report Post  
B. R.Ramachandran
 
Posts: n/a
Default

Hi,

This could be one approach (there may be more elegant ones that I can't
think of).

You need a helper column to extract the numeral parts of the job numbers for
sorting purposes.
Supposing the job numbers are in column A starting at row 2, the formula in
row 2 of the helper column would be,
=IF(ISTEXT(A2)*1=1,LEFT(A2,LEN(A2)-1)*1,A2)
Now you could sort the spreadsheet by this helper column.

If it is possible that you could have entries starting with the same numbers
followed by different literal characters for different jobs (e.g., 772, 772A,
772X....), then you need two helper columns that would become the sorting
criteria.
=IF(ISTEXT(A2)*1=1,LEFT(A2,LEN(A2)-1)*1,A2), and
=IF(ISTEXT(A2)*1=1,RIGHT(A2,1),"")
Now you would sort the spread sheet first by the helper column 1 and then by
helper column 2.
Hope this helps. Regards.

B.R.Ramachandran


"roger_home" wrote:


My company has a 3 or 4 digit job number on all its jobs (i.e., 872,
944, 1015)...when I do a sort by number, all is fine. But occasionally
we add a A or a X to the end of the number (i.e., 772A, 1001X). Now
when I do a sort by number, these go the the bottom. Any way to keep
them in order by number?


--
roger_home
------------------------------------------------------------------------
roger_home's Profile: http://www.excelforum.com/member.php...o&userid=16434
View this thread: http://www.excelforum.com/showthread...hreadid=385270


  #5   Report Post  
Martin P
 
Posts: n/a
Default

You could add spaces after the numbers that have only digits. Word's Search
and Replace is a useful tool for this if you use wildcards.

"roger_home" wrote:


My company has a 3 or 4 digit job number on all its jobs (i.e., 872,
944, 1015)...when I do a sort by number, all is fine. But occasionally
we add a A or a X to the end of the number (i.e., 772A, 1001X). Now
when I do a sort by number, these go the the bottom. Any way to keep
them in order by number?


--
roger_home
------------------------------------------------------------------------
roger_home's Profile: http://www.excelforum.com/member.php...o&userid=16434
View this thread: http://www.excelforum.com/showthread...hreadid=385270


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
minus numbers causing a problem kevhatch New Users to Excel 14 June 30th 05 01:15 PM
sort numbers based on initial digit. Andyd Excel Discussion (Misc queries) 2 June 28th 05 01:20 PM
Sort Problem jdb Excel Discussion (Misc queries) 1 January 10th 05 11:05 PM
sort + & - numbers together Rasoul Khoshravan Azar Excel Worksheet Functions 1 December 18th 04 11:11 PM
How do I reference and sort a range of numbers in Excel 97? Old Northern Excel Worksheet Functions 3 December 14th 04 03:15 PM


All times are GMT +1. The time now is 03:30 PM.

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"