Mengurutkan rentang atau larik
=SORT(array, [sort_index], [sort_order], [by_col])
| Parameter | Deskripsi |
|---|---|
array |
Range or array to sort. |
sort_index |
[optional] Column index to use for sorting. Default is 1. |
sort_order |
[optional] 1 = Ascending, -1 = Descending. Default is ascending order. |
by_col |
[optional] TRUE = sort by column. FALSE = sort by row. Default is FALSE. |
To sort in ascending or descending order:
=SORT(A1:A10) // sort A-Z (ascending)
=SORT(A1:A10,,-1) // Z-A (descending)
To sort by a specific column:
=SORT(A1:B10) // sort by column 1, ascending
=SORT(A1:B10,2) // sort by column 2, ascending
=SORT(A1:B10,2,-1) // sort by column 2, descending
In its simplest form, the SORT function sorts a single column of data in ascending order. In the worksheet below, the goal is to sort names in column
=SORT(B5:B16)
When data has multiple columns, use sort_index to specify which column to sort by. In the worksheet below, the goal is to sort names and scores by sco
=SORT(B5:C16,2,-1)
The SORT function has the ability to sort data vertically (by row) or horizontally (by column). To sort data horizontally, set by_col to TRUE. In the
=SORT(B4:K5,2,-1,TRUE)
The SORT function pairs well with FILTER to filter and sort data in one step. In the worksheet below, the goal is to extract the top n scores (where n
=SORT(FILTER(B5:C16,C5:C16>=LARGE(C5:C16,F2)),2,-1)