Excel Tutorial
Excel tutorials, quizzes & AI guides — all levels
RSS
  • Online Excel Exercises
  • Training
  • Excel Tests
  • Sitemap
  • Premium Quizzes
  • Shop
  • My account

Mastering the SORT Function in Excel

Dynamic Arrays
Reading time: 2 minutes
Views: 14,594

The Excel SORT function is a powerful tool that lets you organize data in ascending or descending order, improving efficiency when working with large datasets. Understanding how to use the SORT function can save time and simplify data analysis.

How to Write the SORT Function

To use the SORT function, follow this format:

  • array: The range you want to sort.
  • sort_index (optional): The column or row index to sort by, with 1 as the default.
  • sort_order (optional): Choose 1 for ascending or -1 for descending order; ascending is the default.
  • by_col (optional): Sorts by columns if set to TRUE or rows if set to FALSE. The default is row sorting.

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

How to Use the SORT Function

The SORT function is simple to use:

  1. Enter the SORT function in a cell.
  2. Choose the range of cells you want to sort.
  3. Press Enter, and the data will be sorted in ascending (alphabetical) order by default.

Whenever you update a cell within the source range, the sorted list will automatically refresh to reflect the new values.

Example SORT function with update data

You can also select multiple columns, but you can only specify one column as the key for sorting. In the following example:

  1. We sort by the first column in the table. If no sort_index is specified, Excel defaults to the first column as the sorted column.
  2. Next, we specify sorting by the Date column (third column of the table).
  3. Then, we sort by the Fruit column (second column of the table).
  4. Finally, we arrange the data in descending alphabetical order by setting the third argument to -1.
Sort function with many columns

This function is particularly effective when combined with dynamic arrays, like UNIQUE, as it automatically updates sorted data when you change the source values.

SORT Function with non-adjacent columns

To return a table with non-adjacent columns in Excel, you can combine the SORT function with the CHOOSECOLS function. The CHOOSECOLS function allows you to specify which columns to include from a given array,

Build a custom sort with the CHOOSECOLS function

Related articles

  • Excel Tutorial – Learn the secrets of Sorting Data
  • UNIQUE Function – Remove duplicates with formulas
  • Adding Headers to Tables Built with Dynamic Arrays

Frédéric LE GUEN

CHOOSECOLS, Dynamic arrays, SORT

Leave a Reply Cancel reply

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

Most Viewed Posts

  • Displaying Negative Numbers in Parentheses in Excel (310,065)
  • Top 10 Excel Functions You Must Know (232,001)
  • How to make automatic calendar in Excel (212,775)
  • Dash for a zero in Excel automatically (190,812)
  • Converting a Date from YYYYMMDD to DD/MM/YYYY in Excel (171,033)
image excel exercises
Excel Exercises
image excel quizzes
Excel Quizzes

Mastering the SORT Function in Excel

Reading time: 2 minutes
Views: 14,594

The Excel SORT function is a powerful tool that lets you organize data in ascending or descending order, improving efficiency when working with large datasets. Understanding how to use the SORT function can save time and simplify data analysis.

How to Write the SORT Function

To use the SORT function, follow this format:

  • array: The range you want to sort.
  • sort_index (optional): The column or row index to sort by, with 1 as the default.
  • sort_order (optional): Choose 1 for ascending or -1 for descending order; ascending is the default.
  • by_col (optional): Sorts by columns if set to TRUE or rows if set to FALSE. The default is row sorting.

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

How to Use the SORT Function

The SORT function is simple to use:

  1. Enter the SORT function in a cell.
  2. Choose the range of cells you want to sort.
  3. Press Enter, and the data will be sorted in ascending (alphabetical) order by default.

Whenever you update a cell within the source range, the sorted list will automatically refresh to reflect the new values.

Example SORT function with update data

You can also select multiple columns, but you can only specify one column as the key for sorting. In the following example:

  1. We sort by the first column in the table. If no sort_index is specified, Excel defaults to the first column as the sorted column.
  2. Next, we specify sorting by the Date column (third column of the table).
  3. Then, we sort by the Fruit column (second column of the table).
  4. Finally, we arrange the data in descending alphabetical order by setting the third argument to -1.
Sort function with many columns

This function is particularly effective when combined with dynamic arrays, like UNIQUE, as it automatically updates sorted data when you change the source values.

SORT Function with non-adjacent columns

To return a table with non-adjacent columns in Excel, you can combine the SORT function with the CHOOSECOLS function. The CHOOSECOLS function allows you to specify which columns to include from a given array,

Build a custom sort with the CHOOSECOLS function

Related articles

  • Excel Tutorial – Learn the secrets of Sorting Data
  • UNIQUE Function – Remove duplicates with formulas
  • Adding Headers to Tables Built with Dynamic Arrays
Tags: CHOOSECOLSDynamic arraysSORT

Frédéric LE GUEN

Leave a Reply Cancel reply

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

Contact us
About me 
Privacy Policy

© 2022 – 2026 – excel-tutorial.com. All Rights Reserved.
Excel Tutorial is managed by majordome du net

Contact us
About me 
Privacy Policy

© 2022 – 2026 – excel-tutorial.com. All Rights Reserved.
Excel Tutorial is managed by majordome du net