How to sort a list alphanumerically


#1

Dear All,
please help me in sorting a list alphanumerically . Priority has to be given to alphabetic order, then numeric order.

Thanks in advance!


#2

If “parameterName” is a string, you can use the standard sort function as you can see in the sample below.
sorting
But as you can also see in the sample, numbers have a lower value and come first (see 2a and a2). But as long as the number comes after the characters, as it is the case in your sample, it works (a2 is before b1). So if you use List.Sort your sample will be sorted as you wanted it.

If the standard sort function does not serve your needs you probably have to use “sort by function” and write the function to compare the strings by yourself.

If you write your own compare function you could first filter all alphabetic characters, sort by that and then sort the items where the characters are the same by the numbers.