View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Coderre Ron Coderre is offline
external usenet poster
 
Posts: 2,118
Default Sorting problem, need some help

I think in this case "helper" columns are in order

With
A1:A8 containing your posted data

Then
B1: =LEFT(A1,FIND("-",A1)-1)
C1: =SUBSTITUTE(A1,B1&"-","")

Copy those formula down through Row_8

Select A1:C8
From the Excel main menu:
<data<sort
Col_B: Ascending
Col_C: Ascending
At the option screens: Treat anything that looks like a number as a number

click the [OK] button

Then just delete the Col_B and Col_C formulas

Alternatively:
You could use a "one formula"approach
B1: ==REPT("0",8-FIND("-",A1))&A1

Then just sort on Columns A and B

Does that help?
***********
Regards,
Ron

XL2002, WinXP


"Chris B" wrote:

I'm trying to sort a text field that has both numbers and alphas in it, I am
not able to get it to sort right at all. Listed is how it is sorting followed
by how it needs to be. Any help would be appreciated.

This is how it is sorting:
1002086-A
1002-G
1003923-FB
1003-A
1003-G
1005243-01
1005-G
20-A

I need it to sort:
20-A
1002-G
1003-A
1003-G
1005-G
1002086-A
1003923-FB
1005243-01