=SORT(array, [sort_index], [sort_order], [by_col])One free generation or explanation per browser, shared across Excel and Google Sheets. Account usage limits apply afterward.
Need more than a single SORT formula? Try our free AI for Excel — it reads your entire spreadsheet, answers questions in plain English, and builds charts and analysis in the same chat.
array:
The range or array of values that you want to sort.
sort_index:
The column or row number in the array by which to sort. This is optional and defaults to 1 if omitted.
sort_order:
The order in which to sort the data. Use 1 for ascending order and -1 for descending order. This is optional and defaults to 1 if omitted.
by_col:
A logical value that indicates the direction of the sort. Use TRUE to sort by column and FALSE to sort by row. This is optional and defaults to FALSE if omitted.
The SORT function in Excel is a powerful tool that allows you to sort a range or array of data based on one or more columns. It can arrange your data in ascending or descending order, making it easier to analyze and interpret.
In simpler terms, the SORT function helps you organize your data in a way that highlights trends and patterns, enhancing your ability to make informed decisions.
Imagine you are managing a student grades report, and you have the following data in an Excel spreadsheet:
| Student Name | Grade | Age |
|---|---|---|
| Alice | 85 | 20 |
| Bob | 90 | 21 |
| Charlie | 78 | 19 |
| David | 92 | 22 |
| Eve | 88 | 20 |
You want to sort the students by their grades in descending order.
To sort the student grades in descending order, you would use the SORT formula as follows:
=SORT(A2:C6, 2, -1)When you apply the formula, it sorts the students based on their grades in descending order. The output would be:
| Student Name | Grade | Age |
|---|---|---|
| David | 92 | 22 |
| Bob | 90 | 21 |
| Eve | 88 | 20 |
| Alice | 85 | 20 |
| Charlie | 78 | 19 |
Here, the students are organized from the highest grade to the lowest grade.
The SORT function is particularly useful when you need to organize data for better readability and analysis. It allows you to quickly arrange your data without manually sorting it, saving you time and effort.
Understanding how to use the SORT function can significantly enhance your data management capabilities in Excel, enabling you to present your datasets in a more meaningful way.
Happy sorting!
You have a table where Column A contains product names and Column B contains their corresponding sales figures. You can use the SORT function to arrange the products in descending order based on their sales figures. This allows for quick identification of top-selling products, facilitating inventory management and marketing strategies without the need for manual sorting or complex data manipulation.
Beyond the SORT function: Better Analyst is a full Excel AI that goes well past individual formulas. Upload any spreadsheet and ask questions in plain English — you'll get formulas, data analysis, and charts back in seconds. It's a free AI Excel assistant that works with any .xlsx, .xls, or .csv file — no plugins, no Microsoft 365 required.
Don't have a spreadsheet yet? Use our free AI spreadsheet generator to turn a text prompt into a downloadable Excel file — a full AI Excel sheet maker that builds headers, columns, and formulas from your description.
Create a free account for formula help, explanations, and spreadsheet analysis. Usage limits depend on your plan.
Browse our complete library of Excel formula guides
Compare your options
Open a neutral research prompt in the AI tool you already use. Compare capabilities, limitations, and fit before you choose.
AI answers can be incomplete. Check source links, current pricing, and product documentation before deciding.