SORTBY Function Explained

The SORTBY function in Microsoft Excel allows users to sort a range of cells based on the values in one or more columns. It takes up to three arguments: the range of cells to sort, the column to sort by, and the order to sort in (ascending or descending). The function returns a sorted range of cells.

SORTBY Function Syntax

SORTBY(array, by_array1, [sort_order1], [by_array2, [sort_order2], [by_array3, [sort_order3], …])

  • array: The range of cells or array to sort.
  • by_array1: The first range of cells or array to sort by.
  • sort_order1: [optional] The order to sort by. 1 = ascending, -1 = descending.
  • by_array2: [optional] The second range of cells or array to sort by.
  • sort_order2: [optional] The order to sort by. 1 = ascending, -1 = descending.
  • by_array3: [optional] The third range of cells or array to sort by.
  • sort_order3: [optional] The order to sort by. 1 = ascending, -1 = descending.