FormulaCraft

How to sort a range by multiple columns in Excel and Google Sheets

Excel & Google Sheets
=SORT(A1:B4,2,FALSE,1,TRUE)

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1Select the range of data you want to sort.
  2. 2In Excel, go to the Data tab and click on Sort. In Google Sheets, click on Data > Sort range by column.
  3. 3Choose the first column to sort by and specify ascending or descending order.
  4. 4Click Add level to add another sorting criterion and select the second column and its order.
  5. 5Click OK to apply the sorting.

Tips

Working on a sheet you inherited? Run the Auditor on the whole file first — it flags every #REF!, #N/A, broken column pattern, and inconsistent formula in seconds, free, no signup.

Frequently asked

Can I sort by more than two columns?

Yes, you can add up to three levels of sorting criteria in both Excel and Google Sheets.

What happens if I don't include headers in the range?

Headers will be sorted along with the data, which might not be desirable. Include them in the selection and choose to keep them fixed in the sort options.

Is there a way to sort without using the UI?

Yes, you can use the SORT function in both Excel and Google Sheets to sort data programmatically.

Formulas used

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: