SORT
Sorts a series of values in ascending order and returns them as an array for easy ranking and analysis.
Last updated
Was this helpful?
Sorts a series of values in ascending order and returns them as an array for easy ranking and analysis.
The SORT function accepts a series of values and returns them as an array sorted in ascending order. It organizes the input numbers from the smallest to the largest, allowing individual elements to be accessed using their index positions. The function is useful for analyzing ranked data, identifying minimum or maximum values, and performing comparisons after ordering the dataset.
SORT(value1,[value2]...)value1,[value2] – A series of numerical values to be sorted (Required).
Consider that we are analyzing quarterly revenue. We need to determine the least but one revenue amount. In order to achieve this, we can use the sort function to sort the quarterly revenue for each row in ascending order. The sort function returns an array, we can access the elements using their index as shown in the image below.

In the example above, the variable 'a' holds the resulting array from the sort function. We can then access the least quarterly revenue element using the index a[0] and the highest quarterly revenue using a[3].
To sort in descending order use the SORTDESC function.
Last updated
Was this helpful?
Was this helpful?