Skip to main content

Sort

Sort the rows of a range, an Excel table or the used area by one column and an optional second column, ascending or descending, keeping a header row in place; or sort only that column's cells.

Command in the Excel toolkit · id ooa.excel/sort_range · 11 inputs (1 required), no outputs

Inputs​

InputTypeRequiredDefaultWhat it is
ColumnAnyYesSort column: letter, 1-based sheet column number, or header name.
DescendingBooleanNofalseSort from largest to smallest.
First row is the headerBooleanNoThe first row is a header and stays at the top; the workbook's open setting (true by default) when empty.
RangeStringNoRange to sort; the used area when empty.
SheetStringNoSheet name; active sheet when empty.
SessionStringNoexcelWorkbook session.
Then byAnyNoSecond sort column used when the first column's values are equal: letter, number or header name.
Then descendingBooleanNofalseSort the second column from largest to smallest.
TableStringNoExcel table name, e.g. Table1: sort that table's rows (its header row stays); sheet and range are then not used.
Only columnBooleanNofalseSort only the cells of the sort column and leave the other columns as they are (rows no longer stay together).
Sort asStringNoautoauto keeps numbers before text as Excel does; number sorts numbers written as text by their value; text sorts everything as text.