Sorting data efficiently is a key step in Excel-based analysis. With Excel’s modern SORT function, you can organize data dynamically without altering the original dataset. As your data changes, the sorted output updates automatically, helping you analyze information faster and more accurately.

Excel Sort Function
The SORT function is a dynamic array function that arranges data in ascending or descending order while keeping the source data intact.
Key benefits:
- Original data remains unchanged
- Results update automatically
- Works seamlessly with other dynamic functions like FILTER and UNIQUE
Syntax:
=SORT(array, [sort_index], [sort_order], [by_col])
- array: The range or array to sort
- sort_index (optional): Column (or row) number to sort by
- sort_order (optional):
1for ascending,-1for descending - by_col (optional):
FALSE(default) sorts by column,TRUEsorts by row
Basic Excel SORT Formula
Read below to learn the basic formula for sorting data in Excel in ascending and descending order given for your reference,
Sort Data in Ascending Order
To sort values in column B from smallest to largest, here's the MS Excel formula to use:
- =SORT(A2:B8, 2, 1)
Sort Data in Descending Order
To sort a range of data in descending order in Excel, set the sort_order argument to -1 like this:
- =SORT(A2:B8, 2, -1)
How to Sort Data in Excel Using Formulas
Sorting data in Excel using formulas allows for the dynamic and automated organization of data without manual intervention.
1. How to Sort One Column in Excel
- To sort by column in Excel, set the by_col argument to TRUE.
- In this case, sort_index will represent a row, not a column.
Read the given below article to learn the process of Sorting one Column in Excel.
2. How to Sort Multiple Columns in Excel
- When working with complex data models, you may often need a multi-level sort.
- Supply array constants for the sort_index and sort_order arguments.
You can also read the below article to know the whole procedure of 'Sorting multiple Columns in Excel'.
Sort and Filter in Excel
When you need to filter data based on specific criteria and sort the output, you can use the `SORT` and `FILTER` functions together.
- SORT(FILTER(array, criteria_range=criteria), [sort_index], [sort_order], [by_col])
Example: Filter only Sales data and sort by revenue: =SORT(FILTER(A2:C10, C2:C10="Sales"), 2, -1)
Excel SORT Function Not Working
If your `SORT` formula in Microsoft Excel isn't working, it could be due to several reasons. These tips should help you troubleshoot issues with sorting data in Excel using formulas.
- #NAME? → Excel version doesn’t support SORT (requires Excel 365 / 2021+)
- #SPILL! → Clear blocked or merged cells in the spill range
- #VALUE! → Invalid
sort_indexorsort_order - #REF! → Source workbook is closed
Read More: