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

I think it's reasonable to want the following items sorted in the following
order:
170B
424
439A
628
731
735
D08
D15

and, in fact, that's how I need them. However, Excel insists on putting them
in this order, which is rather scrambled but somewhat logical:
424
628
731
735
170B
439A
D08
D15
It appears to be sorting numbers first and then anything that contains an
alpha (treating digits as letters). Is there a way to get the first sort
order?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Sorting

170b is not a number, it's text.

I would try to separate the data into 3 columns--alphabetic prefix, numeric base
and alphabetic suffix (the prefix and base could be ""). Then sort the data by
these 3 helper columns.

But the formulas in those helper columns would depend on what can be in the
original column of data.

Is it always a single alpha either at the left or right of the string--never
both, sometimes both?

You may want to post a description and a representative sample of data to get
the formulas right.

This assumes that it's @####@ or ####@ or @#####.

In B1:
=IF(ISNUMBER(A1),"",IF(ISNUMBER(-RIGHT(A1,1)),LEFT(A1,1),""))

in C1:
=IF(ISNUMBER(A1),A1,
IF(ISNUMBER(-RIGHT(A1,1)),--RIGHT(A1,LEN(A1)-1),--LEFT(A1,LEN(A1)-1)))

In D1:
=IF(ISNUMBER(A1),"",IF(ISNUMBER(-RIGHT(A1,1)),"",RIGHT(A1,1)))

And then drag down as far as the data goes.

Then sort A:D by column B, then C, then D.



Slim Slender wrote:

I think it's reasonable to want the following items sorted in the following
order:
170B
424
439A
628
731
735
D08
D15

and, in fact, that's how I need them. However, Excel insists on putting them
in this order, which is rather scrambled but somewhat logical:
424
628
731
735
170B
439A
D08
D15
It appears to be sorting numbers first and then anything that contains an
alpha (treating digits as letters). Is there a way to get the first sort
order?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,722
Default Sorting

You could use a helper column with the formula:

=LEFT(A2,3)

And then sort based on the helper column. BTW, you are correct, XL sorts
numbers first, then blanks and symbols, then text. see "Default sort orders"
under XL help for further detail.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Slim Slender" wrote:

I think it's reasonable to want the following items sorted in the following
order:
170B
424
439A
628
731
735
D08
D15

and, in fact, that's how I need them. However, Excel insists on putting them
in this order, which is rather scrambled but somewhat logical:
424
628
731
735
170B
439A
D08
D15
It appears to be sorting numbers first and then anything that contains an
alpha (treating digits as letters). Is there a way to get the first sort
order?

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 Values Without Sorting Formulas SBX Excel Discussion (Misc queries) 2 April 12th 09 11:17 PM
Automatic sorting (giving max and min) based on custom sorting lis Joe Lewis[_2_] Excel Worksheet Functions 4 November 23rd 08 05:12 AM
Sorting VLookup vs Sorting SumProduct Lauren Excel Discussion (Misc queries) 1 August 21st 07 12:19 AM
Help with sorting jlynch Excel Worksheet Functions 3 September 18th 06 09:03 PM
Sorting: Sorting by the First Character dzuy Excel Discussion (Misc queries) 2 June 22nd 06 08:27 PM


All times are GMT +1. The time now is 11:10 PM.

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

About Us

"It's about Microsoft Excel"