How to Sort a Column in Excel: 6 Methods (Ascending, Custom, Multi-Level)

How to sort a column in Excel — single column A-Z/Z-A, multi-level, custom lists, by formula, by color, and the SORT/SORTBY dynamic array functions.

Microsoft ExcelBy Katherine LeeMay 20, 202615 min read
How to Sort a Column in Excel: 6 Methods (Ascending, Custom, Multi-Level)

Sorting a column in Excel sounds like a one-click operation, and 90% of the time it is. But the other 10% is where people get burned — sorting a column while the rest of the row gets left behind, sorting numbers that look like text and ending up with 1, 10, 11, 2, 3, sorting dates that aren't actually formatted as dates, or trying to sort across merged cells and getting blocked.

This guide covers the simple cases first, then the edge cases that trip people up, and finally the modern dynamic array functions (SORT and SORTBY) that have changed how Excel handles sorted data since Microsoft 365 introduced them.

The fundamental operation is straightforward: select a cell in the column you want to sort by, click the A-Z or Z-A button on the Data tab (or use the keyboard shortcut), and Excel sorts the entire data range based on that column. The catch is that Excel decides what "the entire data range" is based on contiguous non-empty cells around your selection.

If you have a blank row between your data and other content, Excel will correctly identify the data range. If you don't, it can pull in unrelated columns and sort them too — which is fine if that's what you want, problematic if it isn't.

For most everyday cases, single-column sorting works exactly as expected and the keyboard shortcut is Alt + A + S + A for ascending or Alt + A + S + D for descending. (On a Mac, the menu is under Data > Sort, accessed differently.) That's it — select cell, hit shortcut, done.

The complications start when you want to do anything more than a basic single-column ascending sort. Sorting by multiple columns (sort by department, then within each department by salary), sorting by custom criteria (Jan, Feb, Mar instead of alphabetical), sorting by color, sorting by formula result, and sorting that updates dynamically as your data changes — all require either the Custom Sort dialog or the SORT/SORTBY dynamic array functions.

This article walks through six distinct sort methods, when to use each, and the specific gotchas for each.

The methods are: (1) basic single-column sort with A-Z/Z-A buttons, (2) multi-level sort via the Custom Sort dialog, (3) sort by custom list (months, weekdays, custom order), (4) sort by color or icon, (5) sort using the SORT function (dynamic array), and (6) sort using SORTBY (dynamic array with separate sort key column). We'll also cover how to handle the merged-cell problem, how to sort dates correctly, and how to fix the "text that looks like numbers" issue that causes 1, 10, 11, 2, 3 ordering.

Excel Column Sorting — Quick Reference

  • Basic A-Z sort: Data tab → A-Z button, or keyboard shortcut Alt + A + S + A
  • Multi-level sort: Data tab → Sort button → Custom Sort dialog
  • Custom list sort: Custom Sort dialog → Order dropdown → Custom List
  • SORT function: =SORT(range, [sort_index], [sort_order]) — Microsoft 365 / Excel 2021+
  • SORTBY function: =SORTBY(range, by_array, [sort_order]) — sorts by external column
  • Filter sort: Filter dropdown on column header → Sort A-Z. Works on filtered data; sorts visible cells only.
  • Common error: Excel asks to expand selection — say Yes if related columns should be sorted together, No if only the selected column should sort.

Method 1: Basic ascending or descending sort on a single column. Click any cell in the column you want to sort. On the Data tab in the ribbon, find the Sort & Filter group. The A-Z button sorts ascending (alphabetical for text, smallest-to-largest for numbers, oldest-to-newest for dates). The Z-A button sorts descending.

The critical moment is the "Expand Selection" prompt. If your data is in a contiguous range with other columns, Excel asks whether to expand the selection to include the adjacent columns. Click "Expand the selection" if the rows are related (a typical spreadsheet with multiple columns of related data). Click "Continue with the current selection" if you specifically want to sort only one column independently of the others (rare and usually a bad idea — your row alignment breaks).

Method 2: Multi-level sort using the Custom Sort dialog. On the Data tab, click the Sort button (not A-Z; the bigger Sort icon). This opens a Sort dialog where you can specify multiple sort levels. Sort by Department first, then within each department, sort by Salary descending. Excel handles up to 64 sort levels in one operation. Click "Add Level" to add another tier. Each level has its own column and ascending/descending choice.

For multi-level sorting to work correctly, your data should have header rows. In the Sort dialog, make sure the "My data has headers" checkbox is checked. This tells Excel that the first row is column names rather than data, and prevents it from sorting your headers into the data.

Method 3: Custom list sort. Sometimes you want to sort by a specific non-alphabetical order. Sort months as Jan, Feb, Mar instead of alphabetical Apr, Aug, Dec. Sort weekdays as Mon, Tue, Wed instead of Fri, Mon, Sat. Or sort by your company's custom priority order (e.g., Critical, High, Medium, Low instead of alphabetical High, Critical, Low, Medium).

To do this, open the Custom Sort dialog and in the Order column, click the dropdown and select Custom List. Excel comes with several built-in lists (months full and abbreviated, weekdays full and abbreviated). You can also create your own custom lists. Once created, your custom list appears in the Order dropdown for any future sort operation.

Microsoft Excel - Microsoft Excel certification study resource

Common Sort Scenarios

Single column, simple A-Z

Use the A-Z button on the Data tab. Click a cell in the column, then the button. Excel sorts the entire connected data range based on that column.

Multi-column with priority

Use Custom Sort. Sort by Region first, then State, then City. Excel handles up to 64 sort levels in a single sort operation.

Custom non-alphabetical order

Use Custom List in the Custom Sort dialog. Built-in lists for months/weekdays; create your own for company-specific priority orders.

Sort by formula result

Add a helper column with the formula. Sort by the helper column. Or use SORT function in dynamic array Excel: =SORT(range, sort_col_index).

Sort that updates dynamically

Use SORT function. Original data unchanged; result spills into a sorted dynamic array that recalculates when source changes.

Sort by external column

Use SORTBY function. Sort one range based on values in a separate range. Useful when sort key column is somewhere else.

Method 4: Sort by color or icon. Open the Custom Sort dialog. In the "Sort On" column, change Values to Cell Color, Font Color, or Conditional Formatting Icon. Then in the Order column, specify which color/icon should be at the top.

This is useful when you've used conditional formatting to flag rows (red = high priority, green = complete, etc.) and you want all the flagged rows grouped together. Multi-level sort can combine color sort with value sort — sort by color first, then by date within each color group.

Method 5: SORT function (Microsoft 365 / Excel 2021+). The SORT function returns a sorted array without modifying your original data. Syntax: =SORT(array, [sort_index], [sort_order], [by_col]). The array is your data range, sort_index is the column number within that range to sort by (default 1), sort_order is 1 for ascending or -1 for descending (default 1), and by_col tells Excel to sort by column rather than row (rare; default sorts by row).

Example: =SORT(A2:D100, 3, -1) sorts the range A2:D100 by the third column (column C) in descending order. The result spills into a dynamic array starting at the cell where the formula is entered. The original A2:D100 stays unchanged. This is enormously useful for dashboards where you want the data sorted on screen but the underlying data left in its original order.

The function recalculates automatically when the source data changes — so if you add a new row to A2:D100, the SORT result updates to include it.

Method 6: SORTBY function. Where SORT lets you choose which column to sort by within the array, SORTBY lets you sort by a completely separate range. Syntax: =SORTBY(array, by_array1, [sort_order1], [by_array2], [sort_order2], ...).

Example: =SORTBY(A2:A100, B2:B100, -1) returns the values from A2:A100 sorted by the values in B2:B100 descending. This is useful when you want to return a smaller subset of columns sorted by a key elsewhere on the sheet. Multiple by_array parameters allow multi-level sorting similar to Custom Sort.

Sort Methods in Detail

  1. Click any cell in the column you want to sort by
  2. On the Data tab, click A-Z (ascending) or Z-A (descending)
  3. If the prompt appears, choose "Expand the selection" to keep rows aligned
  4. Confirm the result — check that headers stayed in row 1 and rows are in the right order

Keyboard shortcut: Alt + A + S + A for A-Z, Alt + A + S + D for Z-A (Windows)

Excel Spreadsheet - Microsoft Excel certification study resource

The merged cells problem is one of Excel's most common frustrations. If you try to sort a range containing merged cells, Excel typically refuses with an error: "This operation requires the merged cells to be identically sized." The fix is to unmerge the cells first. Select the range, then on the Home tab click Merge & Center to toggle it off.

Once unmerged, you can sort normally. If you needed the merged appearance for formatting reasons, consider using "Center Across Selection" (Format Cells > Alignment > Horizontal: Center Across Selection) instead of true merging — this gives the visual appearance of merged cells without breaking sort operations.

The text-that-looks-like-numbers problem causes the infamous 1, 10, 11, 2, 3 ordering. Excel sorts text alphabetically character-by-character, so "10" comes before "2" because the character "1" comes before "2". This happens when numbers are stored as text — either typed with a leading apostrophe, imported from a CSV with text-formatted cells, or pasted from a system that exports numbers as strings.

The fix is to convert text-numbers to actual numbers. Select the cells. If you see green triangles in the corner of cells, click one — Excel offers "Convert to Number" in the dropdown. Alternatively, type 1 in an empty cell, copy it, select the text-numbers, and use Paste Special > Multiply. This multiplies each cell by 1, forcing Excel to convert the text to a number.

Sorting dates correctly requires the dates to be stored as date values, not text. To check: click a date cell. If the formula bar shows the date in a date format (like 1/15/2026) and the cell shows the formatted version (like January 15, 2026), it's a date. If the formula bar shows exactly what's displayed (text), the cell contains text that looks like a date but isn't.

To convert text-dates to real dates, select the cells, go to Data > Text to Columns, click Next twice, and on Step 3 choose Date format with the appropriate order (MDY for U.S. format, DMY for European). Click Finish. The cells now contain proper date values that sort chronologically.

Another method for date conversion is the DATEVALUE function: in an empty column, type =DATEVALUE(A2) where A2 is your text-date. Copy down. The result is a date serial number; format it as date and copy values back over the original column.

Sort behavior with hidden rows or filtered data deserves specific attention. If you have filters active and you sort using the Data tab buttons, Excel sorts only the visible rows. The hidden (filtered-out) rows stay in their original positions. This is usually what you want — it lets you sort within a filtered view without disturbing the underlying data structure.

However, if you sort using the keyboard shortcut Alt + A + S + A on filtered data, Excel may still sort the full dataset depending on your selection. To explicitly sort only visible rows, use the filter dropdown on the column header (not the Data tab button) — the dropdown's Sort A-Z and Sort Z-A options always operate on visible data only.

Sort behavior with Excel Tables (formatted tables, created via Insert > Table) is more reliable than sorting on regular ranges. Tables automatically expand their range as you add rows. When you sort a Table, Excel always sorts the entire Table — no "Expand Selection" prompt needed. This is one of several reasons converting your data to a Table before sorting is generally a good practice for any spreadsheet you'll work with repeatedly.

To convert a range to a Table: select the data, press Ctrl+T, confirm the headers checkbox, click OK. The data now has Table formatting (alternating row colors, header dropdowns) and supports auto-expanding ranges. Sort by clicking the dropdown in any column header. The Table also supports structured references in formulas, which makes complex sorting and filtering easier.

Choosing the Right Sort Method

Single column, simple A-Z?

Click cell → Data tab → A-Z button. Or Alt + A + S + A. Done in 2 clicks.

Multiple sort columns with priority?

Data tab → Sort button → Custom Sort dialog. Add Level for each sort tier. Up to 64 levels.

Non-alphabetical custom order?

Custom Sort → Order column → Custom List. Pick built-in (months, weekdays) or create your own list.

Sort by color or icon?

Custom Sort → Sort On column → Cell Color / Font Color / Icon. Specify which color is on top.

Need result that updates automatically?

Use SORT or SORTBY function (Microsoft 365 / Excel 2021+). Dynamic array spills into adjacent cells; updates when source changes.

Result needs to be in a separate location?

SORT function in a new location, referencing the original range. Original data stays untouched.
Excellence Playa Mujeres - Microsoft Excel certification study resource

How do i sort a column in excel — the more conversational variant of the search query — usually means someone wants the simplest answer. The simplest answer is: click any cell in the column you want to sort by, then click the A-Z button on the Data tab. That's it. Everything else in this guide is a refinement for specific cases.

If your data is in a normal range (not a Table) and Excel asks whether to expand the selection, say yes unless you specifically want to scramble your data by sorting one column independently. If your data is already a Table, the A-Z button on the column header dropdown is the cleanest path.

If your sort doesn't work as expected — numbers sorting alphabetically (1, 10, 11, 2), dates not sorting chronologically, or sort being blocked entirely — the issue is almost always either text-formatted data masquerading as numbers/dates, or merged cells. Both have specific fixes covered above.

Excel sort operations also interact with formulas in interesting ways. If a cell contains a formula that references other cells in the data range, sorting can change which rows the formula references after sort. For pure relative references this is usually fine — the formula still points at the cell next to it.

For absolute references ($A$2 syntax) the reference stays fixed regardless of sort. Mixed references (some absolute, some relative) can produce unexpected results. The general advice: before sorting data with complex formulas, copy the data, paste it as values into a new sheet, and sort the values. The original formulas remain intact in the original sheet for reference if needed.

For frequently-sorted data, consider using Excel's Power Query (Get & Transform) to create a sorted result that refreshes from source data without modifying the source. Power Query is more setup work upfront but eliminates the manual sort-each-time workflow for recurring reports.

Common Sort Errors and Fixes

1, 10, 11, 2, 3 ordering

Numbers stored as text. Select cells → green triangle dropdown → Convert to Number. Or Paste Special > Multiply by 1.

Dates sort wrong

Text-dates not real dates. Data → Text to Columns → Date format. Or use DATEVALUE function.

Merged cells error

"This operation requires identically sized merged cells." Unmerge: select range → Home → Merge & Center to toggle off.

Wrong rows being sorted

Header row included in sort. Check "My data has headers" in Custom Sort dialog. Or convert range to Table (Ctrl+T).

Some columns out of order after sort

Expand Selection wasn't selected. Undo (Ctrl+Z) and re-sort, this time choosing Expand the selection.

SORT function returns #SPILL!

Adjacent cells aren't empty. Move source data or formula to a location with empty cells where the result can spill.

How Pros and Cons

Pros
  • +How has a publicly available content blueprint — you know exactly what to prepare for
  • +Multiple preparation pathways accommodate different schedules and budgets
  • +Clear score reporting shows specific strengths and weaknesses
  • +Study communities share current insights from recent test-takers
  • +Retake policies allow recovery from a difficult first attempt
Cons
  • Tested content scope requires substantial preparation time
  • No single resource covers everything optimally
  • Exam-day performance can differ from practice test performance
  • Registration, prep, and retake costs accumulate significantly
  • Content changes between versions can make older materials less reliable

EXCEL Questions and Answers

Sorting a column in Excel is a one-click operation for the simple case and a 6-method decision tree for everything else. For everyday work — sorting a list of names alphabetically, putting numbers in order, ordering dates chronologically — the A-Z button on the Data tab is everything you need. Click cell, click button, confirm Expand Selection prompt, done.

For more complex sorting needs, the Custom Sort dialog (multi-level, custom orders, by color) covers most professional spreadsheet use cases. And for spreadsheets where you want sorting to update automatically as data changes, the SORT and SORTBY dynamic array functions in modern Excel provide a cleaner solution than manually re-sorting. Pick the method that matches your specific case rather than always defaulting to the same approach — the wrong method for the situation creates more work than it saves.

About the Author

Katherine LeeMBA, CPA, PHR, PMP

Business Consultant & Professional Certification Advisor

Wharton School, University of Pennsylvania

Katherine Lee earned her MBA from the Wharton School at the University of Pennsylvania and holds CPA, PHR, and PMP certifications. With a background spanning corporate finance, human resources, and project management, she has coached professionals preparing for CPA, CMA, PHR/SPHR, PMP, and financial services licensing exams.