The bettet way I know is to change W1 to W01 and then sort it. After that, and if you need, just remove the zeros again.
Main Topics
Browse All TopicsDoes anyone have a good algorithm for sorting letters with #'s? What I get when I do my sort is Alphabetical, but it screws up the numbers, so say I have
W1 to W20
When I sort it I get
W1, W11, W12, W13, W14, W15, W16, W17, W18, W19, W2, W20, W3, W4, W5, W6
But what I want is for the numbers to be sorted according to #.
W1, W2, W3, W4, W5... W18, W19, W20.
Anyone seen a sort like this?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi
This little beast is nice and over-complicated. It will sort pretty much anything like what you're wanting.
It breaks each element of the array to be sorted into text/numeric chunks and sorts each individually, therefore overcoming any data type mismatch problems (i.e. your numbers being sorted as text).
E.g.
W11 -> A3
W9 -> AA9
W3 -> AA21
C4 -> AB12
C19 -> C4
W6 -> C19
W17 -> CA3
W8 -> CA12
W12 -> CZ1
A3 -> D10
W1 -> FED45C
W13 -> FED45S
D10 -> FED45Z
W14 -> FZA14
W20 -> W1
Z16 -> W3
Z7 -> W5
W18 -> W6
W5 -> W8
W15 -> W9
AB12 -> W11
AA21 -> W12
CA3 -> W13
CA12 -> W14
CZ1 -> W15
FZA14 -> W17
FED45Z -> W18
FED45S -> W20
FED45C -> Z7
AA9 -> Z16
Business Accounts
Answer for Membership
by: rachitkohliPosted on 2008-05-22 at 21:44:19ID: 21629463
You can sort it.
While sorting, replace the constant code (i.e. in your case "W") & then perform a sort.
By the way how are you sorting this