Lexicographically ascending with index
Hello, how can we retrieve the index values of the ascending sort data while performing a lexicographical ascend?
cat ant bat elephant dog
will get sorted as
ant bat cat dog elephant
but how to get the index values of this sort, i.e.
2 3 1 5 4
Lycan Thrope last edited by
The same way you’s sort the word list. Using your list of numbers, I just sorted it Lexicographically Ascending as the screenshots show.
Using the Edit Menu:
No, not like this.
The list is linguistic-only, made of words, not numbers.
‘Ant’ is at line#2, hence when the list of animals is sorted alphabetically, it rises to the top and occupies position#1. However, in the original list, its index-value was 2. How to recover this index value?
Similarly, the word ‘Dog’ was at line#5 before sorting. After sort, its position is at line#4. How to get the information that its original index-value was 5?
Here is the table of new versus old index-values of the given animal list:
new old 1 2 2 3 3 1 4 5 5 4
How can we get this table? The list to be sorted is non-numerical, containing only words.
Neil Schipper last edited by
@amazon-books You can insert a column of ascending numbers to the right of your text. See Edit|Column Editor.
After sorting, you can use column select (Alt-mouse, or Alt-Shift-arrows) and cut, and perhaps Edit|Blank Operations|Trim Trailing to clean up.
What you’re trying to do is done much more naturally in a spreadsheet.
Alan Kilborn last edited by
Elaborating on Neil’s reply:
Hold Alt while left-clicking on the first line, in the whitespace out to the far right (in a column number greater than the length of the longest line you are going to sort), and then drag down in the same column, to get a “selection” that looks like this:
Press Alt+c and set up the box that appears like this:
Press OK and your data will be transformed like this:
Do your sort to obtain:
@alan-kilborn Many thanks.