excel logo with attractive background

How to Sort Data in Excel With the SORT Function

Excel is the final word instrument for interacting with and presenting knowledge. The extra readable your knowledge is, the better it’s to grasp. One method to make arrays and tables simpler to learn in Excel is to kind them. Excel has many options that you need to use for this goal, together with the SORT operate.

The SORT operate leaves the unique desk unchanged and as an alternative creates a sorted copy of it in your spreadsheet. Learn on to study what the SORT operate is and the way you need to use it in Excel.

What Is the SORT Operate?

SORT is a core operate in Excel that takes an array, then types it based mostly on the parameters you have entered for it. The SORT operate can kind columns and rows, and you may outline which column or row it ought to kind your array on. The syntax for the SORT operate is as beneath:

=SORT (array, [sort_index], [sort_order], [by_col])
  • array: The array that you just need to kind utilizing this operate.
  • sort_index: The row or column that the operate ought to take as the kind foundation. This might be a single quantity counting from the beginning level of the array.
  • sort_order: This can decide whether or not the array ought to be sorted in ascending or descending order. 1 is ascending, -1 is descending.
  • by_col: Signifies whether or not columns ought to be sorted or rows. Setting this to TRUE will kind columns, which is utilized in horizontal arrays. Setting it to FALSE will kind rows, which is utilized in vertical arrays.

The one obligatory parameter right here is the array itself. All the opposite parameters are non-obligatory, and you may have the kind operate work with simply the array. By default, the operate will assume sort_index as 1, sort_order as 1, and by_col as FALSE.


When you’re extra of a macro individual, it’s also possible to use Excel macros for sorting knowledge, slightly than features.

The best way to Use the SORT Operate in Excel

SORT function sample in Excel.

On this pattern spreadsheet, we now have the whole factors every participant has amassed in a board sport. This spreadsheet accommodates two tables, one vertical and one horizontal, together with the names of the gamers and their factors.

The purpose is to kind the tables based mostly on the scores in descending order. The participant with the very best rating might be on the high of the sorted desk. Obtain this spreadsheet to get began.

Sorting Rows with the SORT Operate

Sorting by row in Excel.

First, let’s kind the vertical desk. Earlier than getting began, let’s get a rundown of how we would like the sorted desk to be. The purpose is to kind the desk (A2:B11) based mostly on the factors (the second column from left). This desk might be sorted in descending order, and the rows might be sorted.

Now we are able to kind the desk:

  1. Choose the cell the place you need to place the brand new sorted desk. That might be cell D2 on this instance.
  2. Within the formulation bar, enter the formulation beneath:
    =SORT(A2:B11, 2, -1, FALSE)

    This formulation calls on the SORT operate and tells it to kind the array in A2:B11. It then instructs it to kind the array based mostly on the second column (2) , and to kind them in descending order (-1). Lastly, the formulation instructs SORT to kind the rows, as a result of the by_col parameter is ready to FALSE.

  3. Press Enter. Excel will now create a sorted copy of your desk!

Sorting Columns With the SORT Operate

Sorting by column in Excel.

The second a part of this activity is to kind the horizontal desk. The purpose is to kind the second desk (H1:Q2) based mostly on the factors (second row from high) and to kind them in ascending order.

  1. Choose the cell the place you need to present the sorted desk. This might be cell H6 on this instance.
  2. Enter the formulation beneath within the formulation bar:
    =SORT(H1:Q2, 2, 1, TRUE)

    This formulation summons the SORT operate to kind the array in H1:Q2. The array is sorted by the values within the second row (2) and it’s in ascending order (1). Because the array is horizontal, the columns are sorted. Thus, by_col is ready to TRUE.

  3. Press Enter. Excel will now kind the horizontal desk.

If you wish to kind a desk by date with out creating a brand new copy of it, you need to use the Type & Filter instrument in Excel. This fashion, you will not want to make use of any features, and the adjustments might be utilized to the unique desk.

Type Your Spreadsheets With the SORT Operate

There are a lot of strategies for organizing your spreadsheets, and one is to kind your arrays with the SORT operate. The SORT operate leaves the unique array unchanged and as an alternative creates a sorted copy of the array.

Now that you know the way to make use of the SORT operate to kind your arrays, take it to the subsequent stage by studying to prepare your spreadsheets in Excel.

8 Methods to Manage Your Spreadsheets in Excel

There are a lot of methods to prepare your Excel spreadsheet in a means that appears extra interesting. This is the best way to do it!

Learn Subsequent

About The Creator

Leave a Comment

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