Alphanumeric Sort

G

Guest

I have a range of unique identifiers A1 through A500.
I sort on a different column then need to resort on those unique identifiers.
How do I prevent
a1
a10
a100
a101
a102
a103
a104
a105
a106
a107
a108
a109

When it should be
a1
a2
a3
a4
a5
a6
a7
a8
a9


Thanks,
Arturo
 
D

Dave O

Because the entries start with "a", Excel interprets the entire cell
and each of the cell's components as text. Even though the cells
contain numbers, Excel sorts them textually, and "103" appears before
"2" in an alpha sorted list.

If the format of your entries is alpha-#-#-# then one way to sort the
list is to write this formula for each entry in column B:
=Mid(A1,1,1)

.... and this entry in column C:
=value(mid(A1,2,len(A1))

Then sort simultaneously on columns B and C.
 
M

Myrna Larson

And, for completeness, the other way is to use leading zeroes in the numeric
portion of the data in column a, i.e. A003 rather than A3
 
G

Gord Dibben

Arturo

Easiest would be to have another column with the numbers 1 - 500

Sort on that column to get original order back.


Gord Dibben Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top