Apple Numbers: How can I sort numbers alphabetically rather than lexicographically

When I use Organize > Sort > Column A > Ascending (1, 2, 3....) it sorts like this:

Fruits 1

Fruits 10

Fruits 11

Fruits 12

Fruits 2

Fruits 3

Fruits 4

Fruits 5

Fruits 6

Fruits 7

Fruits 8

Fruits 9


I believe this is lexicographic sorting. How can I sort it alphabetically so my list is like this:

Fruits 1

Fruits 2

Fruits 3

Fruits 4

Fruits 5

Fruits 6

Fruits 7

Fruits 8

Fruits 9

Fruits 10

Fruits 11

Fruits 12


There doesn't seem to be any other options other than sort Ascending and sort Descending


I know I can prefix with the single digit numbers with a zero to make them sort how I wish, but it's annoying to have to do that all the time. Is there a better way?


Environment:

Numbers version 13.1 (7037.0.101)

Mac OS 12.7.1

MacBook Pro 15″, macOS 12.5

Posted on Nov 27, 2023 4:35 AM

Reply
1 reply

Nov 27, 2023 5:56 AM in response to big_smile

You could create two columns to separate the elements, to allow sorting first on the word and then on the number. The columns can be hidden afterward if you set a permanent Sort in the Organize tool.


Let's say Fruits x is in column A


The first sorting column:

=TEXTBEFORE(A1," ")


The second sorting column:

=VALUE(TEXTAFTER(A1," "))


This assumes that your example is representative of your actual table, which is not always the case when people ask this kind of question. If your texts are more complicated, then regular expressions (REGEX) may be needed.

Apple Numbers: How can I sort numbers alphabetically rather than lexicographically

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