How to Use the Excel SORT Function to Reorder Data Quickly

The SORT function is a cool addition that Microsoft introduced in Office 365 and Excel 2021 and it’s something you might want to learn about!

The Excel SORT function reorders the contents of an array or range in ascending or descending order. The SORT function returns a dynamic array of results. If the source data changes, the SORT function’s output updates automatically.

Let’s take a look at the SORT function’s syntax.

SORT Function Syntax

The SORT function in Excel accepts 4 arguments:

=SORT (array, [sort_index], [sort_order], [by_col])

array is a required argument and identifies the range or array to be sorted.

sort_index is an optional parameter and identifies the column to be sorted. The default is 1.

sort_order is an optional parameter. 1 = Ascending, -1 = Descending. The default is 1 (ascending).

by_col is an optional parameter that specifies how data should be sorted. TRUE = by column, FALSE = by row. The default is FALSE.

Using the SORT Function in Excel

An example might be helpful at this point.

First, let’s look at the sample data we’ll be using. This spreadsheet contains a list of employee names and salaries. Neither column has been sorted.

A list of names and salaries

Sorting Rows in Ascending Order

If you want to use the sort function to reorder the list by employee name in alphabetical order, you would click in an adjacent cell and type =SORT(A4:B13,1,1,FALSE) then press Enter.

Sorted by name in ascending order

Because we wanted to sort a range using values in the first column and all of our records are in rows, we could have typed =SORT(A4:B13) instead.

If you omit the optional parameters, the sort function assumes that your data is arranged in rows – and you want to do an ascending sort using the first column in the range.

Gotta love shortcuts!

Sorting Rows in Descending Order

Here’s a second example.

If you want to use the sort function to reorder your list by salary in descending order, you would click in an adjacent cell and type =SORT(A4:B13,2,-1,FALSE) then press Enter.

Excel SORT Function: Final Thoughts

The SORT function in Excel provides a quick and easy way to sort information when you don’t want to change how the source data is displayed.

The function can sort data from multiple columns and the output can be displayed in ascending or descending order.

Remember: the SORT function’s output is dynamic and the function is only available in Office 365 and Excel 2021 (or later).

What’s Next?

The SORT function is just one of over 200 functions available in Excel.

If you want learn about other Excel functions, you might want to check out XLOOKUP vs VLOOKUP: Excel Trainer Explains Key Differences. Both of these functions are really useful any time you need to combine data from multiple sources.

See you next time!

By Michael Belfry

Working as a full-time training consultant, Michael provides Microsoft Office courses to government and private sector clients across Canada.