It is now possible to dynamically sort your data with the SORT function
The SORT function
The SORT function is available only with Microsoft 365 and Excel Online and it's very easy to use it.
- Write the name SORT
- Select the column to sort
It's really too simple with the dynamic arrays (DA) 😉
SORT and Remove duplicates
On the previous example, even if the result is correct, it isn't convenient.
In this situation, it's better to use the UNIQUE function to remove duplicates first, and then SORT the result. Like this
Sort on multi-columns
For the moment, we have used the SORT function on a single column. But, you can also selected a table with many columns as first argument.
With this writing, the key sort is by default the first column of the selection.
Specify the sorting column
Now, if you want to sort on a specific column, you must fill the second argument of the function SORT.
- Select your range of cells to sort
- Write the column index of the sorting key.
Ascending or descending order
By default, the SORT function returns the result in ascending order. But if you want the result in descending order, you just have to indicate the value -1 in third argument.