How to Make Sortable Headings in Excel

To make sortable headings in Excel, click any cell in your data and choose Data > Filter. Every header cell gets an arrow, and clicking it sorts that column while each row stays together.

Your spreadsheet has a header row, and you want to click a column heading and sort or filter the rows under it the way you can on a website table. Steps cover Excel for Microsoft 365 and Excel 2016 through 2024 on Windows, plus Excel for the web.

Add Sort Arrows to Your Header Row With Filter

A “sortable heading” in Excel is simply a header cell with a filter arrow (Microsoft calls it the column header arrow). The arrow holds both the sort commands and the filter checklist for that column. Before you start, check that your data has exactly one header row at the top, no completely blank rows or columns in the middle, and one kind of value per column (all dates in the date column, all numbers in the amount column).

  1. Click one cell anywhere inside your data. You don’t need to select the whole range; Excel finds the edges of the block on its own.
  2. Open the Data tab on the ribbon.
  3. Click Filter in the Sort & Filter group. A small arrow appears at the right edge of each header cell.
Excel header row with filter arrows after clicking Data and Filter
Data > Filter adds an arrow to every heading. (Recreated interface)
  1. Click the arrow on the column you want to sort and pick a sort order at the top of the menu.

Microsoft documents this route on its filter data in a range or table page. If the arrows land on the wrong row, your real headings probably aren’t in the first row of the block. Turn Filter off, delete any title rows or blank rows above the headings (or click a cell lower in the data), and turn it back on.

Sort From a Heading Arrow

The sort choices in the arrow menu change with the type of data in the column, which is a quick way to tell whether Excel sees your values the way you do:

Column containsSort choices you will see
TextSort A to Z, Sort Z to A
NumbersSort Smallest to Largest, Sort Largest to Smallest
Dates or timesSort Oldest to Newest, Sort Newest to Oldest
Excel column header arrow menu showing date sort options
The sort choices change with the type of data in the column. (Recreated interface)

Say the Lakeside Running Club keeps a member list with Name, Team, Join Date and Dues columns. Clicking the Join Date arrow and choosing Sort Oldest to Newest puts the longest-standing members at the top, and every member’s team and dues move with them. If your date column offers A to Z instead of Oldest to Newest, the dates are stored as text; the fix is in the troubleshooting section below, and there is a separate walkthrough for sorting by date in Excel Online.

The Data tab also has quick sort buttons in the Sort & Filter group (Sort A to Z and Sort Z to A; for numbers and dates they sort smallest to largest or oldest to newest). They work without filter arrows: click a cell in the column, then click a button.

Make the Arrows Permanent With an Excel Table

Filter arrows on a plain range are easy to switch off by accident with one click of the Filter button. Converting the range into an Excel table gives the header row its own built-in arrows, plus banded styling that makes long lists easier to read.

  1. Click a cell inside your data.
  2. Choose Home > Format as Table and pick a style.
  3. In the dialog, confirm the range and mark the option that says your table has headers. Leave it unmarked only if row 1 holds data, in which case Excel adds generic headings such as Column1 and Column2.
  4. Click OK. Filter controls are added to the table headers automatically.

Microsoft’s create and format tables page covers the style choices. One trade-off: tables can’t sort left to right, so if you need that, keep the data as a plain range.

Sort by More Than One Column

Clicking one arrow sorts by one column. To sort the running club by Team and then by Name inside each team, use the Sort dialog:

  1. Click a cell in the data, then choose Data > Sort.
  2. Check that My data has headers is ticked, so the dropdowns list your heading names instead of Column A, Column B.
  3. Under Sort by, choose Team. Leave Sort On at Cell Values and set Order to A to Z.
  4. Click Add Level. In the new Then by row, choose Name and A to Z.
Excel Sort dialog with two sort levels added
Add Level creates a second sort rule. (Recreated interface)
  1. Click OK.

Levels higher in the list win, so use the up and down arrow buttons in the dialog to change priority. You can add up to 64 levels, and Copy Level and Delete Level are there if you want to duplicate or drop one.

Sort by Color or by a Custom List

In the Sort dialog, the Sort On box also offers Cell Color, Font Color and Cell Icon. Pick the color under Order, then choose On Top or On Bottom. Excel has no default color order, so add one level per color in the order you want. This pairs well with highlights you set up through conditional formatting in Excel, such as red fill for unpaid dues.

For values that have a natural order but aren’t alphabetical (High, Medium, Low, or month names), choose Custom List under Order. Excel includes day and month lists; to make your own, go to File > Options > Advanced, scroll to General, and click Edit Custom Lists. Microsoft notes a custom list can be up to 255 characters and its first character can’t be a number.

Need “smith” and “Smith” treated differently? Click Options in the Sort dialog and tick Case sensitive.

Sort Left to Right Across Columns

If your headings run down column A and your records run across the sheet, you are sorting columns, not rows. Filter arrows can’t do this. Open Data > Sort, click Options, choose Sort left to right under Orientation, click OK, then choose the row to sort by under Sort by. If the data is an Excel table, convert it back to a normal range first, because tables don’t support left-to-right sorting.

Sortable Headings in Excel for the Web

In Excel for the web, data formatted as a table already has filter buttons in the header row: select an arrow and choose a sort order. For a plain range, select a cell in the column, go to the Data tab and choose Sort Ascending or Sort Descending. Custom Sort on the Data tab handles several columns. If a sort goes wrong, use the Undo button on the Home tab.

Microsoft lists Excel for Microsoft 365 for Mac on its filter and table pages, so on a Mac look for the same Filter command on the Data tab and Format as Table on the Home tab.

Why a Sort Goes Wrong and How to Fix It

Most “Excel sorted it wrong” moments trace back to the data, not the sort. Microsoft’s sort data in a range or table page lists these causes:

  • Numbers or dates stored as text. Text numbers sort as text, so 100 can land before 25. Select the column, press Ctrl+1 and apply a Number or Date format, then re-enter or convert the values.
  • Leading spaces. An invisible space in front of a name pushes it to the top of an A to Z sort. The TRIM function removes them.
  • Blank cells. Blanks always go to the bottom, in both directions. That is by design.
  • Hidden rows or columns. They don’t move during a sort, so their data ends up out of line. Unhide the rows first.
  • Headings in more than one row. Microsoft recommends a single heading row. If you need a two-line label, wrap the text inside one cell instead.
  • Formulas. Formula results can change after a recalculation, which can make a sorted list look unsorted. Sort again to bring the order up to date.

If Excel refuses to sort and mentions merged cells, look for merged cells in the range and unmerge them, then sort again.

If you select an entire column and click a sort button, Excel may warn you because other columns sit next to it. Choose Expand the selection to keep each row together. Continue with the current selection sorts only that column and scrambles your records, so avoid it unless that column really stands alone.

Remove the Arrows or Undo a Sort

Press Ctrl+Z right after a sort to put the rows back. Once you have saved and closed the file, Undo can’t help, so if the original order matters, add an ID column numbered 1, 2, 3 before you sort. Sorting that column smallest to largest restores the original order at any time.

To clear a filter from one column, click its arrow and choose Clear Filter From followed by the column name. Data > Clear clears every filter on the sheet, and clicking Data > Filter again removes the arrows entirely. Microsoft’s clear or remove a filter page also gives the Alt+D+F+F key sequence for that last step. Clearing a filter does not undo a sort; the rows stay in their sorted order.

Questions About Sortable Headers in Excel

Why did my heading row get sorted into the data?

Excel decided the first row was data. Open Home > Editing > Sort & Filter > Custom Sort (or Data > Sort), tick My data has headers, and sort again. When that box is ticked, the heading stays out of the sort; when it is cleared, row 1 is sorted like any other row.

Can I keep the headings visible while I scroll a long sorted list?

Yes. Click cell A2, then choose View > Freeze Panes > Freeze Panes, which locks everything above the selected cell. The full options are in this tutorial on freezing panes in Excel.

Why does “A100” sort between “A1” and “A11”?

Mixed letters and numbers are sorted as text, character by character, so A1, A100, A11 is the expected order. If the number part matters, split it into its own column and sort by that.

Will other people see my sort when they open a shared file?

A sort physically reorders the rows, so yes, it is saved with the workbook. A filter only hides rows, and hidden rows come back when someone clears it.

Next, try a two-level sort on a copy of a real list to see how Then by levels change the result.