How does it work? – It helps to Sorts a table based on the column(s) specified.
SORTBY Formula breakdown:
=SORTBY(array, by_array1, sort_order1, [by_array2, sort_order2], …)
=SORTBY(data to be sorted, by which column to sort first, [by which column to sort afterward], …)If you want to sort your table data with an Excel Formula then you can do it now with Excel’s SORTBY Formula. It will also help you to sort by multiple columns. It is a new formula introduced in Office 365 which was released in 2018.
Here I have a personal list that I need to sort by Gender in ascending order and then by Sales also in ascending order.
Before doing this remember that to specify the sorting order;
- 1 represents ascending order
- -1 represents descending order.
Following are the detailed steps to follow:
STEP 1: firstly you have to enter the SORTBY function in a blank cell of your table e.g.
STEP 2: now continue with the SORTBY arguments.
Write the data to be sorted in the place of array so to do this select the cells that contain the person data which do not include the headers:
Select the cells that contain the gender column and then type in 1 so that in result it will become ascending order.
=SORTBY(A2:C1001, A2:A1001, 1
Select the cells that contain the age column and then type in 1 to get ascending order in the result.
=SORTBY( A2:C1001, A2:A1001, 1, C2:C1001, 1)
There you go with your result.