# How to Sort Columns in Excel
> How to sort columns in Excel: A–Z from the Data tab, sort by two columns, and the SORT function that spills a live sorted list. Includes a free practice lesson.

- Web page: https://logicexcel.com/tutorials/sort
- Language: en
- Also in: [Deutsch](https://logicexcel.com/de/tutorials/sort.md), [Español](https://logicexcel.com/es/tutorials/sort.md), [Français](https://logicexcel.com/fr/tutorials/sort.md)
- Practice this in the browser: https://logicexcel.com/practice/91

Sorting rearranges rows so a column runs A–Z, Z–A, smallest to largest, or largest to smallest. Excel will happily sort one column and leave the others behind if you select only that column — that is the usual way a table gets scrambled.

## Method 1: Data tab (the everyday sort)

1. Click a single cell inside the column you want to sort — not the whole column, one cell
2. **Data → A–Z** (ascending) or **Z–A** (descending)
3. If Excel asks "Expand the selection?", choose **Expand**. That keeps each row together

Custom sort (two keys, e.g. Region then Amount):

1. Click inside the table
2. **Data → Sort**
3. Add a level for Region (A–Z), then a level for Amount (Largest to Smallest)
4. Tick **My data has headers** if row 1 is labels

Always expand the selection. Sorting one column in isolation is how "Lee" ends up next to someone else's order total.

## Method 2: SORT function (Microsoft 365 / Excel 2021)

SORT spills a new sorted copy and leaves the source alone. That is the version you can practice in the browser, because it is a formula.

```
=SORT(A2:A6)
```

Sorts the names (or numbers) in A2:A6 ascending and spills the result down from the formula cell.

Descending:

```
=SORT(A2:A6,,-1)
```

The third argument is `1` for ascending (default) or `-1` for descending.

Sort a whole block by the second column:

```
=SORT(A2:C6, 2, 1)
```

`2` means "use column 2 of the array as the key." Amounts in column B, names in A, regions in C — this sorts the rows by amount, smallest first, and returns all three columns.

## SORT vs the Data tab

| | Data tab | SORT function |
| --- | --- | --- |
| Edits the source | Yes | No — spills a copy |
| Updates when data changes | No | Yes |
| Works in Excel 2019 | Yes | No |
| Good for a one-off cleanup | Yes | Overkill |
| Good for a dashboard | No | Yes |

## Sort left to right (by a row, not a column)

Rare, but useful for wide month columns:

1. Data → Sort → **Options → Sort left to right**
2. Choose the row that holds the sort key

The SORT function can do this with its fourth argument set to TRUE (sort by row).

## Frequently Asked Questions

### How do I sort a column in Excel without mixing up the rows?

Click one cell in the column, press A–Z, and choose **Expand the selection** if Excel asks. Do not highlight only that column first.

### How do I sort by two columns?

Data → Sort → Add Level. First key is the group (Region), second key is the tie-break (Amount).

### Why did only one column sort?

You selected that column before clicking A–Z, and chose "Continue with the current selection." Undo, click a single cell, try again, and expand.

### What is the Excel SORT function?

`=SORT(range, [sort_index], [order])` returns a live sorted copy of a range. It requires Microsoft 365 or Excel 2021. Older Excel uses the Data tab only.
