## SORTBY Formula

**Previously in ****Excel Formulas****: ****How to use UNIQUE Formula in Excel?**

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], …)

**Explanation:**

`=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.**

**Click here to enroll in the Microsoft Office Insider Program**

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.

`=SORTBY(`

**STEP 2:** now continue with the **SORTBY **arguments.

*array*

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:

**=SORTBY(A2:C1001,**

*by_array1, sort_order1*

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**

*by_array2, sort_order2*

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.