How to Sort Data in Excel (2026 Guide)
Home›Guides›Sort Data
ExcelHow-To⏱ 1 min read

How to Sort Data in Excel

Excel sorts data three ways: quick sort (one column, ascending or descending), custom sort (multiple columns or custom orders), and the SORT function (live sorting via formula). Each fits a different need.

⚡ Quick Answer

Click any cell in the column, then click Data → Sort A to Z (ascending) or Sort Z to A (descending). For multi-column sorting or custom orders, use Data → Sort (opens the full sort dialog).

Method 1: Quick sort by one column

  1. Click any cell in the column

    Just one cell — Excel expands the sort to the whole dataset.

  2. Click Data → Sort A to Z or Sort Z to A

    Excel sorts the entire dataset by that column, keeping rows together. Headers (row 1) are auto-detected and kept in place.

Never sort just one column

If you select only one column and sort, Excel sorts just that column — leaving the other columns unchanged. Rows get scrambled. Always click just one cell (letting Excel expand) or select the entire dataset before sorting.

Method 2: Multi-column sort

For sorting by Department first, then by Salary within each department.

  1. Click inside your data

    Any cell within the dataset.

  2. Open Data → Sort

    The full sort dialog opens.

  3. Set the primary sort column

    Choose the column from the dropdown, pick order (A→Z, Z→A, custom).

  4. Click Add Level for secondary sort

    Add another sort key. Excel uses this to break ties in the primary sort.

  5. Add more levels as needed and click OK

    Up to 64 sort levels. Excel processes them in order.

Method 3: Custom sort order

Alphabetical order is often wrong for categorical data — "Small, Medium, Large" alphabetized becomes "Large, Medium, Small." Custom sort fixes this.

  1. Open Data → Sort

    Full sort dialog.

  2. In the Order dropdown, choose Custom List

    The Custom Lists dialog opens.

  3. Add your custom order

    Click NEW LIST, type your items in order (Small, Medium, Large — one per line). Click Add.

  4. Select the list and click OK

    Return to Sort dialog with your custom order selected. Click OK to sort.

Method 4: SORT function (Excel 365)

Creates a live-sorted copy of your data that updates as source changes.

=SORT(A2:C100, 2, 1)

Sorts range A2:C100 by column 2 (index within the range), in ascending order (1=asc, -1=desc). Result spills into adjacent cells.

=SORT(A2:C100, {2,3}, {1,-1})

Sorts by column 2 ascending, then column 3 descending. Multi-key sort in a single formula.

Sorting gotchas

  • Numbers stored as text won't sort right. "10" sorts before "2" because it starts with "1". Convert with =VALUE(A1).
  • Dates that are actually text. Look like dates but sort alphabetically. Convert to real dates first.
  • Merged cells break sorting. Excel refuses to sort ranges containing merged cells. Unmerge first.
  • Blank rows break the auto-expand. If there's a blank row in the middle, Excel might only sort part of your data. Fill the blank or select the full range manually.
  • Formulas that reference specific rows. After sorting, formulas pointing to specific row numbers may reference wrong data. Use structured references or table references when possible.

Keyboard shortcuts

Sort Shortcuts

Open Sort dialogAlt + A + S + S
Sort A to ZAlt + A + S + A
Sort Z to AAlt + A + S + D
Smart Sorting

Excel Wizard — sort by meaning, not just alphabet

Sometimes you need "sort by priority" where priority isn't a column. Excel Wizard's AI can rank rows by importance, urgency, similarity to a query, or any criterion you describe. Ask "sort these support tickets by likely severity" — Wizard reads the text and orders accordingly.

Install Excel Wizard →

Frequently asked questions

How do I sort a column in Excel?

Click any cell in the column you want to sort. Go to Data tab, click Sort A to Z (ascending) or Sort Z to A (descending). Excel auto-detects headers and sorts the entire dataset by that column. For text: alphabetical. For numbers: smallest to largest or largest to smallest. For dates: oldest to newest or newest to oldest.

How do I sort by multiple columns in Excel?

Click any cell in your data, go to Data → Sort. In the dialog, choose your primary sort column and order. Click Add Level to add secondary and tertiary sort columns. Excel sorts by the first column, then breaks ties using the second, and so on. Example: sort by Department, then by Salary within each department.

How do I sort without a header row?

Open Data → Sort dialog and uncheck 'My data has headers' at the top-right. Excel will treat row 1 as data and include it in the sort. If left checked, Excel keeps row 1 in place and sorts rows 2 onward — this is usually what you want.

How do I do a custom sort order (e.g., Small, Medium, Large)?

Open Data → Sort. In the Order column dropdown, choose Custom List. Add your custom order (Small, Medium, Large) as a new list. Click OK. Excel sorts using your custom sequence instead of alphabetical order. Custom lists are saved and available in all workbooks.