In Numbers how do I sort an Alpha Numeric column?

I am new to Numbers. I created a spread sheet and I want to do a natural sort in one of the colums. Some of the data is numeric (sample 6000-13) and some alpha-numeric (sample 6000a-13). When I currently try to sort ascending it sorts the numeric data (example: 6000-13, 6001-13) and after all of those it sorts the alpha-numeric data (example 6000-13, 6001-13, 6000a-13, 6000b-13). Can I sort it alpha numerically (example: 6000-13, 6000a-13, 6000b-13, 6001-13)?


(I found a discussion from 2008 that says this can't be done in Numbers but am hoping that this has been resolved since then.)


Thank you for your assistance in this matter. 🙂

Posted on Aug 3, 2012 3:29 PM

Reply
7 replies
Sort By: 

Aug 3, 2012 6:44 PM in response to PattiRon

Patti,


Let's try a test. Copy the list from your last post. Paste it into a blank Numbers table. Sort it.


That's what I did and it sorted properly, again.


If the list from your post sorts properly, then there's something unseen in your original data that is causing the problem. Let me know how your post's data sorts.


Jerry

Reply

Aug 4, 2012 1:17 AM in response to PattiRon

Hi Patti,


Here's the result I get with an acsending sort of the four sample values in your original post:

User uploaded file

I'm not sure why you consider this a "natural" sort. Numbers sorts numeric values according to their magnitude when the entry is interpreted as a 'number'. In an ascending numeric sort, 5 comes before 10 and after 1.


When an entry includes non-numeric characters, such as a, b, or - (in other than the leading position), the entry is interpreted as a text string. Text is sorted according the the ASCII code of each character, ignoring the most significant bit (set to 1 for lower case letters and to 0 for the same letter in upper case) with the string being read from left to right. If all the characters are letters, the sort is in the same order as the alphabetical sort found in an English language dictionary.


The ASCII code values for each character in the sample strings are shown in columns D through K of the table. For sorting purposes A (65) and a (97) the first bit (0 for A, 1 for a) is ignored, and both are sorted as if that bit were set to 0.


As can be seen in the table, all of your examples except one start with the same four characters: 6000

Translating that to a four character ASCII string, the characters are:


6000: 54, 48, 48, 48...

6001: 54, 48, 48, 49...


Comparison of the first four characters is enough to separate 6001... from the other three strings, and to place it at the end os the list.


For the remaining three strings, only one more character must be read to determine the sort order:


6000-... : 54, 48, 48, 48, 45...

6000a...: 54, 48, 48, 48, 65...

6000b...: 54, 48, 48, 48, 66...


For a sort of the four example values given, nothing beyond the fifth character makes any difference to the order these will be sorted.


Regards,

Barry

Reply

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

In Numbers how do I sort an Alpha Numeric column?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.