Sort Rows vs Columns in Excel: How to Choose

Understand the difference and how to switch.

Why does your sort keep reordering the wrong thing, and how do you even tell whether you need to sort rows vs columns in Excel? That's the question most guides assume you've already answered. They jump straight to the click sequence and leave you guessing whether you set up the problem correctly in the first place. This article fixes that. You'll walk away knowing exactly which sort direction your data needs, how to execute both paths, and which failure modes will silently corrupt your results if you're not watching for them. Before you touch anything, make sure you've got a structured data range selected: a table with consistent rows and columns, no merged cells, no randomly blank rows in the middle.

If you're brand new to organizing data in Excel, the Excel for Beginners starter guide covers the foundational concepts worth knowing before this gets technical.


Step 1: Figure Out Whether Your Data Needs a Row Sort or a Column Sort

Every tutorial I've read on this topic goes straight to "click Data, then Sort." None of them ask whether you've diagnosed the problem correctly first. Here's the actual decision you need to make before opening any dialog.

When to sort by column — the default that covers 90% of cases

If your data looks like a standard table (column headers across the top like Name, Date, Amount, Region, and one record per row beneath them) you need a column sort. You're telling Excel: "Reorder these rows based on the values in a specific column." Sort the Amount column ascending and every row moves together as a unit. The name stays attached to the date, stays attached to the amount. That's the entire point.

This is Excel's default behavior, and it covers the vast majority of real-world sorting needs. Sales data, employee lists, transaction logs, inventory records: all of these are row-per-record structures, so ascending/descending column sorts are what you want.

When to sort by row — and what your data has to look like first

Row sorting (also called sorting left to right) applies when your categories run across columns and you want to reorder those columns. Think of a monthly budget where each column is a month (Jan, Feb, Mar...) and you want to reorder months by total spend. Or a comparison table where each column is a product and you want them ranked. The records are horizontal, so the sort needs to be horizontal too.

A quick real-world example: you've got a dashboard with quarterly columns and you want Q4 sorted to the front based on revenue. That's a row sort. Everything else is probably a column sort. If you're unsure, ask yourself: are my records rows or columns? Records as rows means sort by column. Records as columns means sort by row.

For more on structuring data before you sort it, the intro to sorting and filtering in Excel is a solid next step.


Step 2: Run the Sort in Excel

Once you've diagnosed which direction your data needs, the execution is mostly clicks, with one non-obvious detour for row sorts that trips up even experienced users.

How to sort by column using the Data tab

  1. Select any cell inside your data range. Excel will detect the full range automatically.
  2. Go to the Data tab and click Sort.
  3. In the Sort dialog, check My data has headers if your first row contains column labels. Missing this will sort your headers into the data.
  4. Under Sort by, select the column you want to sort on.
  5. Choose your sort order: ascending (A to Z, smallest to largest) or descending (Z to A, largest to smallest).
  6. Click OK.

For sorting by multiple columns at once, the multi-level sorting guide covers that in detail.

How to switch Excel to sort by row instead

This is the part most tutorials skip, and it's why people conclude they're "just not an Excel person" after following instructions that seemed correct. The option isn't on the main Sort screen.

  1. Select your data range manually, including the row labels in column A if you have them.
  2. Go to Data → Sort to open the custom sort dialog.
  3. Click Options — this is the step most people never find.
  4. Under Orientation, select Sort left to right. Click OK.
  5. The Sort by dropdown now shows row numbers instead of column headers. Select the row you want to sort on.
  6. Choose ascending or descending, then click OK.

If your data range is formatted as an official Excel Table (created with Ctrl+T), the row sort option will be grayed out. Excel Tables don't support left-to-right sorting. Convert your table back to a plain range first: click anywhere inside the table, go to Table Design → Convert to Range, then run the sort.


Step 3: Choose Between Manual Sorting and the SORT Function

With the column vs. row decision made and the sort executed, there's one more thing worth surfacing: manual sorts don't update. Ever.

If you sort a column manually today and someone adds 40 rows next week, your sort order is now wrong. You have to run it again. That's fine for a one-time cleanup. It's a problem for any data that changes regularly.

The SORT function (available in Excel 365 and Excel 2021) solves this. It returns a dynamically sorted copy of your data in a separate output range, leaving the original untouched.

Basic syntax: =SORT(array, sort_index, sort_order, by_col)

For a column sort, by_col is FALSE (or omitted). For a row sort (sorting left to right), set by_col to TRUE. In other words, by_col is the SORT function's equivalent of the Options → Sort Left to Right toggle in the manual dialog. The default is FALSE, which is exactly why Excel sorts by column in 90% of cases by default.

SORTBY is worth knowing too. It lets you sort one range based on values in a different range, which is useful when you don't want the sort key column included in your output. For anything that updates frequently, these functions save real time.


Common Mistakes When Sorting Rows vs Columns in Excel

These are more common than the tutorials suggest, and none of them come with a loud warning.

Sorting a single column instead of the full data range

If you click a column header and sort just that column, Excel sometimes prompts you to expand the selection, and sometimes doesn't, depending on context. If it skips the prompt and you confirm a single-column sort, every value in that column shifts independently of the rest of the row. Your names no longer match your amounts. The data looks intact until you actually read it. Always select your full data range before opening the Sort dialog.

Accidentally including headers in the sort range

If My data has headers is unchecked and your first row contains column labels, Excel will sort those labels into the data alphabetically. Always verify that checkbox before clicking OK.

Merged cells

In a sort context, merged cells are particularly destructive. Excel either throws a "to do this, all the merged cells need to be the same size" error or, depending on your version, silently produces corrupted output. Unmerge before sorting. Every time, no exceptions. If you use merged cells for visual formatting, there are better alternatives worth knowing.

If you're on a Mac and the Sort dialog behaves differently than described here, check the guide to sorting and filtering in Excel on Mac — the Options path differs slightly on macOS.

If you take one thing from this article: before you open the Sort dialog, decide whether your records run in rows or in columns. That single question determines everything (which direction to sort, which options to set, and whether the result will make sense). The click sequence is the easy part.


Frequently Asked Questions

How do I sort columns left to right in Excel?

Go to Data → Sort, then click Options inside the Sort dialog. Under Orientation, select Sort left to right and click OK. The Sort by dropdown will now show row numbers instead of column headers. Note that this option is unavailable if your data is formatted as an Excel Table — convert it to a plain range first.

Why does Excel sort rows by default?

Most structured data in Excel is organized with records as rows and attributes as columns, so sorting by column (which reorders rows) covers the vast majority of use cases. The left-to-right orientation exists for the less common case where categories or records run across columns, but it's not the default because most data doesn't need it.

What's the difference between the SORT function and manual sorting in Excel?

Manual sorting rearranges your data in place and doesn't update when the data changes — you have to re-run it each time. The SORT function (Excel 365 and 2021) outputs a dynamically sorted copy in a separate range and updates automatically as the source data changes, while leaving the original dataset untouched.

How do I sort without disrupting other columns in Excel?

Select your full data range before opening the Sort dialog, not just the column you want to sort by. When prompted to expand the selection, always choose to expand. This ensures Excel moves entire rows together, keeping every value aligned with its correct record.