Excel Function

SORT

Sorts an array by specified index/order.

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

Arguments

array

Required

Specify a reference range. You can drag or click start/end cells.

sort_index

Optional

Enter a numeric value.

sort_order

Optional

Enter a numeric value.

by_col

Optional

Specify TRUE or FALSE.

Practice Preview

Use SORT to return the result with these settings (Target range: A2:D8 (columns A to D), Sort index: 4, Sort order: -1 (descending), Compare by column: FALSE (by rows, not columns)). You can set ranges by dragging from the start cell to the end cell in the same argument field.

Example Table

#
AProduct ID
BCategory
CProduct Name
DSales
2P001FoodApple1200
3P002FoodBanana980
4P003StationeryNotebook450
5P004StationeryPen300
6P005FoodGrapes1500
7P006StationeryRuler250
8

How to Use (Formula)

=SORT(A2:D8, 4, -1, FALSE)

Result

P005, Food, Grapes, 1500 | P001, Food, Apple, 1200 | P002, Food, Banana, 980 | P003, Stationery, Notebook, 450 | P004, Stationery, Pen, 300 | P006, Stationery, Ruler, 250 | , , ,

Practice This Function

SORT FAQ

How do I use SORT in Excel?

Use SORT when you want to sort a range. Enter Target range, Sort index, Sort order in that order, then add optional arguments when needed.

Where can I practice SORT?

Use the "Start Function Practice" button to jump straight into SORT drills.

What arguments does SORT use?

The main arguments are Target range, Sort index, Sort order, Compare by column. Start with the required ones, then add optional arguments if needed.