How to Use SORT and SORTBY
Last updated: 2026-09-06
⚡ Quick Answer
SORT and SORTBY dynamic array formulas order range contents automatically based on sort keys.
=SORT(A2:D100, 2, -1)📊 Visual Demo
HOME · INSERT · FORMULAS · DATA
fx =SORT(A2:D100, 2, -1)
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | 1 | A2:D50 | Col 2 (Sales) | -1 (Descending) | =SORT(A2:D50, 2, -1) |
| 2 | 2 | Dynamic Spill | Auto-Updates | — | Sorted Matrix |
| 3 | 3 | Model Flow | Optimized | Verified | Ready |
🧠 Deep Dive
SORT and SORTBY dynamic array formulas order range contents automatically based on sort keys.
Key Insights
- Dynamic arrays calculate once in the top-left cell and spill results automatically.
- Spill ranges resize when source data changes.
- Requires Microsoft 365 or Excel 2021+.
Common Mistakes
- Typing data inside a spill range causes #SPILL! errors.
- Referencing spilled cells with standard ranges.
Pro Tips
- Use IFERROR for empty fallbacks.
- Combine SORT + UNIQUE + FILTER.
FAQ
What does this formula do in plain English?
SORT and SORTBY dynamic array formulas order range contents automatically based on sort keys.
Why is my formula not working?
Typing data inside a spill range causes #SPILL! errors.
Does this work in Google Sheets?
Yes, this syntax is fully compatible with Google Sheets.
What is the most common mistake?
Referencing spilled cells with standard ranges.
Related Guides
How to Use the FILTER Function in ExcelHow to Use the SEQUENCE FunctionHow to Use TRANSPOSE in ExcelHow to Use RANDARRAYExcel Error Hub
Need Complete Playbooks?
Download our verified manuals covering ERP Cleanup and Modeling.
Explore Playbook Series (From ₹199)