SORT function in Excel

SORT function in Excel
Last Updated on 25/04/2024
Reading time: 2 minutes

The SORT function in Excel has been created to sort your data dynamically. The sort function has 3 argument

  1. Your data

    The first argument is the data you want to sort. It could be a single column or a full Excel table.

  2. The key column

    In case you have selected multi-column, you can specify which columns is the sorting column, also named the key column.

  3. Ascending or Descending order

    The value 1 is for Ascending, -1 is for Descending

Let's see many situations how to use the function.

How to use the Excel SORT function?

The SORT function is available only with Microsoft 365 and Excel Online and it's very easy to use it.

  1. Write the name SORT in a cell
  2. Select the column to sort
Sort data with formula

SORT and Remove duplicates

On the previous example, even if the result is correct, we return many times the same value.

In this situation, it's better to use 2 functions

  • UNIQUE to remove duplicates first,
  • and then SORT the result.

In our example, the formula will be

=SORT(UNIQUE(Table1[Fruit]))

SORT and Remove duplicates

Sort on multi-columns

For the moment, we have used the SORT function on a single column. But, you can selected a table with many columns as first argument.

Sort with many columns

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 in the second argument of the function SORT.

  1. Select your range of cells to sort
  2. Write the column index of the sorting key.

=SORT(Table1[[Shop]:[Date]];3)

SORT function Specify 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.

=SORT(Table1[[Shop]:[Date]];3;-1)

SORT function descending order

Leave a Reply

Your email address will not be published. Required fields are marked *

SORT function in Excel

Reading time: 2 minutes
Last Updated on 25/04/2024

The SORT function in Excel has been created to sort your data dynamically. The sort function has 3 argument

  1. Your data

    The first argument is the data you want to sort. It could be a single column or a full Excel table.

  2. The key column

    In case you have selected multi-column, you can specify which columns is the sorting column, also named the key column.

  3. Ascending or Descending order

    The value 1 is for Ascending, -1 is for Descending

Let's see many situations how to use the function.

How to use the Excel SORT function?

The SORT function is available only with Microsoft 365 and Excel Online and it's very easy to use it.

  1. Write the name SORT in a cell
  2. Select the column to sort
Sort data with formula

SORT and Remove duplicates

On the previous example, even if the result is correct, we return many times the same value.

In this situation, it's better to use 2 functions

  • UNIQUE to remove duplicates first,
  • and then SORT the result.

In our example, the formula will be

=SORT(UNIQUE(Table1[Fruit]))

SORT and Remove duplicates

Sort on multi-columns

For the moment, we have used the SORT function on a single column. But, you can selected a table with many columns as first argument.

Sort with many columns

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 in the second argument of the function SORT.

  1. Select your range of cells to sort
  2. Write the column index of the sorting key.

=SORT(Table1[[Shop]:[Date]];3)

SORT function Specify 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.

=SORT(Table1[[Shop]:[Date]];3;-1)

SORT function descending order

Leave a Reply

Your email address will not be published. Required fields are marked *