SORTBY Function in Excel: Sort by Another Column

⏱ 1 min readUpdated 28 September 2026

Dynamic ArrayLevel: ExpertAvailable in: Excel 365 / 2021+

In this article
  1. Syntax
  2. Examples
  3. Example 1
  4. Example 2
  5. Related functions

SORTBY sorts one range by the values in another — even by a column you do not display.

Syntax

=SORTBY(array, by_array1, [sort_order1], ...)
Argument What it means
by_array1 The values to sort by (same height).
sort_order1 1 ascending, −1 descending.

Examples

Example 1

=SORTBY(A2:A50, E2:E50, -1)

Names ordered by sales, highest first.

Example 2

=SORTBY(A2:C50, B2:B50, 1, C2:C50, -1)

By region, then by amount.

SORT · FILTER · TAKE

📚 Part of the free Excel course: Beginner → Expert · Try it in the Formula Lab or ask the AI Helper.

✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free · AI can be wrong