How to Use Excel SORTBY Function in Excel Office 365?
Tags: touseexcelsortbyfunc, excel, excelfunctions
Published: 2021-08-26 08:56:02

---
title: How to Use Excel SORTBY Function in Excel Office 365?
published: true
date: 2021-08-23 15:59:16 UTC
tags: ToUseExcelSORTBYFunc,Excel,ExcelFunctions
canonical_url: https://geekexcel.com/how-to-use-excel-sortby-function-in-excel-office-365/
---

The **SORTBY Function** of Excel can return a **sorted array** by **another independent array** , and you can **add levels of sorting**. In this tutorial, we are going to see how to **use the Excel SORTBY Function In Excel Office 365**. Let’s get into this article!! Get an official version of ** MS Excel**  from the following link: [https://www.microsoft.com/en-in/microsoft-365/excel](https://www.microsoft.com/en-in/microsoft-365/excel)

## SORTBY Function Syntax

```
=SORTBY(array,sorting_array1,[order],…)
```

**Syntax Explanation:**

- **Array** : This is the array that you want to sort.
- **Sorting\_array1** : This is the array by which you want to sort the array. The dimension of this array should be compatible with the array.
- **[order]**: Optional. Set it to -1 if you want the order to be descending. By default, it is ascending(1).

## Example

- You need to **create a sample data** of participants with their **IDs and scores**.

![](https://geekexcel.com/wp-content/uploads/2021/08/Sample-data-26.png)<figcaption>Sample data</figcaption>

- Then, you have to get the **names sorted** by their **IDs** using the **SORTBY function**.
- Now, you need to use the generic **formula** to get the **ascending sorted names by ID column**.

```
=SORTBY(A2:A10,B2:B10)
```

![](https://geekexcel.com/wp-content/uploads/2021/08/Ascending-sorted-names.png)<figcaption>ascending sorted names</figcaption>

- After that, if you want to get whole table, than just give reference of whole table.

```
=SORTBY(A2:A10,B2:B10)
```

- Then, if you want the **range** to be **sorted descending by ID column** , then the **formula** will be:

```
=SORTBY(A2:A10,B2:B10,-1)
```

**Example: Sort Array by More Than One Column**

- Here, in the above examples, you have **sorted the array** by just **one column**.
- Then, you want to **first sort** the above table **ascending by ID** and then **sort the array descending by the score**.
- Now, you need to use the formula given below.

```
=SORTBY(A2:A10,B2:B10,1,C2:C10,-1)
```

**Check this too:** [How to Use Excel SORT Function in Office 365? – [with Example]](https://geekexcel.com/excel-sort-function/)

## Wrap-Up

Hope you understood how to **use the Excel SORTBY Function In Excel Office 365**. Please feel free to state your query or feedback for the above article. Thank you so much for Reading!! To learn more, check out **[Geek Excel](https://geekexcel.com/)!! **and [**Excel Formulas**](https://geekexcel.com/excel-formula/) **!!**

**Read Ahead:**

- **[Excel Formulas to Get the Left Lookup with INDEX and MATCH!!](https://geekexcel.com/excel-formulas-get-left-lookup-with-index-and-match/)**
- **[Excel Formulas: INDEX and MATCH Descending Order ~ Easy Guide!!](https://geekexcel.com/excel-formulas-index-and-match-descending-order/)**
- **[How to Use Excel SORT Function in Office 365? – [with Example]](https://geekexcel.com/excel-sort-function/)**
- **[Excel Formulas to Convert the String into Array ~ Quick Tricks!!](https://geekexcel.com/excel-formulas-to-convert-the-string-into-array/)**
- **[How to Create an Array of Numbers in Excel Office 365?](https://geekexcel.com/how-to-create-an-array-of-numbers-in-excel-office-365/)**