Your cart is currently empty!
How to Use SORT and SORTBY Functions in Excel 365
The SORT and SORTBY functions in Excel 365 are part of the dynamic array family — they allow you to sort data easily, flexibly, and without altering the original range.
🧠 1. SORT Function in Excel
🔧 Syntax:
SORT(array, [sort_index], [sort_order], [by_col])
| Argument | Description |
|---|---|
array | The range or array to sort |
sort_index | Column or row number to sort by (default is 1) |
sort_order | 1 = Ascending, -1 = Descending |
by_col | TRUE = sort by columns, FALSE = by rows (default) |
✅ Real-Life Example: Sorting Employee Salaries
You have the following data in A2:B6:
| Name | Salary |
|---|---|
| Ravi | 35000 |
| Priya | 42000 |
| Neha | 39000 |
| Akash | 30000 |
| Anjali | 45000 |
Formula to sort by Salary (ascending):
=SORT(A2:B6, 2, 1)
✅ Output:
| Name | Salary |
|---|---|
| Akash | 30000 |
| Ravi | 35000 |
| Neha | 39000 |
| Priya | 42000 |
| Anjali | 45000 |
Formula to sort by Salary (descending):
=SORT(A2:B6, 2, -1)
🧠 2. SORTBY Function in Excel
The SORTBY function is more flexible — it allows you to sort one array based on another.
🔧 Syntax:
SORTBY(array, by_array1, [sort_order1], [by_array2], [sort_order2], ...)
| Argument | Description |
|---|---|
array | The data to sort |
by_array1 | The column/array to sort by |
sort_order1 | 1 = Ascending, -1 = Descending |
✅ Real-Life Example: Sort Students by Marks in Another Column
| Student | Roll No | Marks |
|---|---|---|
| Aman | 102 | 87 |
| Kirti | 101 | 92 |
| Mohan | 104 | 76 |
| Preeti | 103 | 89 |
Formula to sort by Marks (descending):
=SORTBY(A2:C5, C2:C5, -1)
✅ Output:
| Student | Roll No | Marks |
|---|---|---|
| Kirti | 101 | 92 |
| Preeti | 103 | 89 |
| Aman | 102 | 87 |
| Mohan | 104 | 76 |
🔄 SORT vs SORTBY: What’s the Difference?
| Feature | SORT | SORTBY |
|---|---|---|
| Sort by position | Yes | No |
| Sort by other data | Limited | ✅ Full flexibility |
| Multiple criteria | Limited | ✅ Supports multiple arrays |
| Practical use cases | Tables, visible data | Sort by hidden/helper columns |
🎯 Real-World Use Cases
- Sort sales data by amount or date
- Sort student scores without rearranging original data
- Sort project tasks by deadline
- Sort inventory by stock level using helper columns
🎓 Want to Learn More Excel Sorting & Automation Tricks?
Explore how to use Excel 365’s new tools like SORT, FILTER, TAKE, UNIQUE, and more in real business applications.
🔗 Mastering MS Excel – A Comprehensive Training Course
✅ Covers:
- Smart Excel functions (
SORT,FILTER,XLOOKUP) - Dashboards & automation
- Excel VBA and real-life case studies
On sale products
-
Bajaj Pulsar NS125 UG ABS Motorcycle
Original price was: ₹110,000.00.₹95,356.00Current price is: ₹95,356.00. -
Copper Diya Shape Flower Decorative for Diwali
Original price was: ₹599.00.₹98.00Current price is: ₹98.00. -
Excel Course in Hindi: Basic to Advanced Level
Original price was: ₹2,299.00.₹2,249.00Current price is: ₹2,249.00. -
Excel Training Program: Fundamentals to Advanced Techniques : Classroom/ Live Classes
Original price was: ₹6,000.00.₹4,000.00Current price is: ₹4,000.00. -
Excel VBA/Macro Masterclass: Automate Excel, Boost Productivity : Classroom /Live Class Training
Original price was: ₹8,500.00.₹6,500.00Current price is: ₹6,500.00. -
Gmail Mastery Training in Hindi: Unlocking Advanced Email Management Technique
Original price was: ₹899.00.₹849.00Current price is: ₹849.00.






