Sorting rows
Sort the rows by one column or by several, as numbers when a column holds numbers, as dates when it holds dates and in natural order when it holds text, or by the length of its values.
Put the cursor in the column to sort by, and choose or . The rows are reordered by that column, the header row stays at the top, and a row with line breaks in a value moves whole.
Each column’s menu has the same two commands: the three dots where the column ends in the column bar above the rows, or a right click on its number. From there, every row is sorted by that column, wherever the cursor is and whatever is selected.
To sort by several columns at once, or to choose how a column’s values are compared, there is : see Sorting by more than one column. It is in each column’s menu too (the three dots beside its number in the column bar), starting with that column.
product,category,price Espresso,coffee,2.20 Matcha latte,tea,4.20 Flat white,coffee,3.40 Chai,tea,3.60 Cold brew,coffee,10.90 Cortado,coffee,3.10 Croissant,bakery,2.60 Earl grey,tea,2.90 Cappuccino,coffee,3.30 Banana bread,bakery,3.20 Mocha,coffee,3.90 Green tea,tea,2.70 Cinnamon roll,bakery,3.50 Americano,coffee,2.60 Rooibos,tea,2.80 Brownie,bakery,2.95 Macchiato,coffee,2.90 Iced tea,tea,3.10 Muffin,bakery,2.75 Latte,coffee,3.50
Numbers, dates and text
A column that Trusty CSV lines up as numbers (see Numbers, dates and other values) is sorted by the value of its numbers: 9.50 before 10.00, with the column’s own decimal separator, so 1.234,56 is read as a little over a thousand. Currency symbols, units and percentages don’t get in the way. The message at the bottom of the window then says as numbers.
A column of dates is sorted by day, and by time within a day, however each date is written: 31/12/2025, 2026-01-05 and 5 Jan 2026 9:30 come in that order. Whether 3/5/2026 is the 3rd of May or the 5th of March is decided as in the filter: the column’s own dates usually say, and when none of them does, the day comes first in a file that writes decimals with a comma and the month first otherwise. Dates with the month’s name (3 May 2026, May 3, 2026) count, though they aren’t lined up as dates. The message then says as dates.
Any other column is sorted as text, in the order a person would use: capitals don’t put a word first, and numbers inside the text compare as numbers, so Item 2 comes before Item 10.
Either way, empty cells and missing values (NA, null, -…) go at the end, in both directions, and so do the values that aren’t numbers in a column of numbers, or dates in one of dates.
Sorting by more than one column
opens a window with the columns to sort by, one to a line. The first is the main one; the second puts in order the rows that are the same in the first, the third those that are the same in the first two, and so on. Sorting by country and then by amount, descending, gives the countries in order, and within each country its largest amounts first.
The window opens with the cursor’s column (or, if columns are selected in the column bar, with those). Add a column adds another line, up to five, and the cross at the end of a line removes it. Each line has three choices:
- the column;
- Ascending or Descending, each column with its own;
- how its values are compared: Automatic, As text or By length (see below).

Under them are the first rows as they will be, which change with every choice, and how many rows will be sorted. Nothing changes until you press Sort, and one Ctrl+Z⌘Z puts the rows back as they were. When the rows are in that order already, the window says so.
Rows that are the same in every column you sort by keep the order they had.
As text or by length
Automatic is what Sort Ascending and Sort Descending do, as described in Numbers, dates and text, and the window says which it is for the column chosen: Automatic (numbers), Automatic (dates) or Automatic (text).
As text compares the values as they are written, whatever the column holds, in the same order as a column of text (Item 2 before Item 10). In a column of numbers or of dates, the values that aren’t one are then sorted among the others instead of going last. It is not the order of the numbers: as text, 1.5 comes before 1.25, since 5 is less than 25, and 1,200 before 9.
By length sorts by how many characters each value has, the shortest first (or the longest, descending): a way to find the code that is a digit short, or the note that won’t fit where the file is going. The length is the one the Column Profile gives: the quotes around a value don’t count, and the spaces at its edges do. To have the values of the same length in order too, add the same column a second time, As text.
Empty cells and missing values go at the end with any of the three.
Only some rows
Select two rows or more (on the line numbers, or any selection that covers them) and only those are sorted, among themselves; the rest of the file stays where it is. With a single cursor, or a selection within one row, every row is sorted. Sort by Several Columns… takes the same rows, and its window says when it will sort only the selected ones. A column’s menu always sorts every row.
With a filter on, the rows that show are sorted among themselves, in the places they have, and the rows it leaves out stay where they are.