2.57 FAQ-500 How do I sort my data?Sort-Data
Last Update: 9/22/2021
To sort the whole worksheet based on the order of a column
Select the column you want to sort on, then choose Worksheet: Sort Worksheet, then choose Ascending or Descending.
If the selected column is Set As Categorical, click By Categorical Order to sort the worksheet by the method listed in the selected column's Categories cell.
Row index relationships are kept upon sorting.
To sort the whole worksheet based on the order of multiple columns
Choose Worksheet: Sort Worksheet, then choose Custom.... Specify which column to sort first, and which column to sort second, etc. by nested sorting.
If the worksheet contains one or more columns of categorical data, you can sort the worksheet on those columns.
Refer to Nested Sorting for more details.
The row indexing relationship across all columns will be kept after sorting.
To sort multiple columns based on the order of a column
If the column to sort on is to the left of other columns, select all those columns you want to sort, select Worksheet: Sort Column, then choose Ascending or Descending. If the left-most column is a categorical column (i.e. it has been Set As Categorical), choose By Categorical Order. These actions will sort all selected columns based on sorting order of left-most column.
If the column to sort on isn't on the left most of other columns, choose Worksheet: Sort Column, then choose Custom.... Specify which column to sort on.
The row indexing relationship across selected columns will be kept after sorting. The row indexing relationship with those columns not selected will be broken.
To sort multiple columns based on the order of multiple column(s)
Select all those columns you want to sort, select Worksheet: Sort Column then choose Custom.... Specify which column to sort first, and which column to sort second, etc. by nested sorting.
Refer to Sorting Worksheet Data for more details of nested sorting.
The row indexing relationship across selected columns will be kept after sorting. The row indexing relationship with those columns not selected will be broken.
To sort a single column only
If you just want to sort one column and not changing corresponding row values in other columns, right click the column header of the single column and choose Sort Column: Ascending or Descending.
To reverse the data order in a single column
If you just want to reverse the order of data in one column without affecting corresponding row values in other columns, click the column header to select the column and from the menu, choose Column: Reverse Order.
To sort each column individually
There is no menu for this. But you can use Set Column Values dialog and call sort() function for this.
To sort each columns in ascending order,
- Select those columns you wish to sort.
- Right-click on your selection and choose Set Multiple Column Values.
- In the Set Values - Multiple Columns dialog box, in the text box under "wcol(j)", enter this expression and click Apply or OK:
sort(wcol(j))
- To sort in descending order, after doing the above steps, right-click on this selection of sorted column values and choose Reverse Order.
The row index relationships across columns will NOT be kept after sort.
To sort columns based on column label row
Right-click on the selected worksheet columns and select Sort Columns by Labels or (with the worksheet active) select Worksheet:Sort Columns by Labels from the main menu.
Refer to Sort Columns by Labels for details.
Keywords:ascending, descending, sort column, label row
Minimum Origin Version Required: 9.1 SR0
|