alpha numeric sort when numbers are decimals? ABC1, ABC2.3, ABC 1.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I sort alpha-numeric when the numbers are decimals. If number is ABC 2
and the ext is ABC14.0, the 14.0 comes before the 2. Excel only recognizes
the first digit and ignores deciam.
 
YOu have two options. One is to modify your data by adding leading zeroes to
the numeric part so all numbers have 2 (or 3) digits, i.e. ABC02.0.

The other is to use Data/Text to columns to split the "numbers" into two
cells, though you'll have problems with that if the alpha prefixes aren't all
the same length.
 
I could your same results for ABC2 (no space) and ABC14.0.

Excel treats your entries like text and 1 comes before 2.

I think I'd put the alphabetic part in one cell and the numeric in an adjacent
cell--then sort by both those helper columns.

If you have 3 alphabetic characters (a1:a9999)
in B1, I'd put: =left(a1,3)
in C1, I'd put =--mid(a1,4,255)

And drag down.

If the text varies, post back with more specifications. I'm sure someone will
come up with a better suggestion.
 
How do I sort alpha-numeric when the numbers are decimals. If number is ABC 2
and the ext is ABC14.0, the 14.0 comes before the 2. Excel only recognizes
the first digit and ignores deciam.

If there are no spaces, and no more than one decimal, you could view your
strings as, for example, a base 16 number, convert it to base 10 in an adjacent
column, and then sort on that column.

If that's a method that appeals to you, I can post my BaseConversion routine
which handles decimals.


--ron
 

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

Back
Top