Skip to Content

SORTBY

Sorts the contents of a range or array based on the values in a corresponding range or array

Syntax

SORTBY(array, by_array1, [sort_order1], [by_array2, sort_order2], ...)

Parameters

  • array: Required. The array or range to sort
  • by_array1: Required. The array or range to sort on
  • sort_order1: Optional. 1 for ascending (default), -1 for descending
  • by_array2: Optional. Additional arrays to sort by

Example

=SORTBY(A1:B10, B1:B10, -1)
Returns: ArraySince: Microsoft 365