ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • About
  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Data tools
  3. Sort Data Horizontally in Excel (Left to Right)

Sort Data Horizontally in Excel (Left to Right)

By ExcelReady Team·Updated November 3, 2026·5 min read

The short answer

To sort horizontally in Excel, select the data columns (not the label column), go to Data > Sort, click Options and choose Sort left to right. Then pick the row to sort by and the order. For a formula that updates by itself, use =SORT(B1:E3,2,-1,TRUE): the TRUE tells SORT to reorder columns instead of rows.

Key takeaways

  • Data > Sort > Options > Sort left to right reorders whole columns by the values in one row.
  • Select only the data columns. The left-to-right sort has no header option, so a label column would be sorted too.
  • =SORT(range, row_number, -1, TRUE) sorts columns with a formula. The fourth argument, by_col, must be TRUE.
  • SORTBY sorts columns when the sort range is a row, such as =SORTBY(B1:E3,B2:E2,-1).
  • SORT and SORTBY need Excel 2021 or Microsoft 365. The Sort dialog works in every version.
On this page+
  1. When do you need to sort horizontally?
  2. How to sort left to right with the Sort dialog
  3. How to sort horizontally with the SORT function
  4. How to sort columns with SORTBY
  5. How to sort horizontally in a custom order
  6. Why is my horizontal sort not working?
  7. Sort or filter: which do you need?
  8. Practise it

Excel sorts top to bottom by default, but you can sort horizontally too, so whole columns swap places based on the values in one row. There are two ways: the Sort dialog's Sort left to right option, and the SORT function with its by_col argument. This guide shows both on one small table, plus SORTBY and the problems that trip people up. It is for anyone whose data runs across the sheet, such as months or regions in columns.

When do you need to sort horizontally?#

You need a horizontal sort when each item is a column instead of a row. This layout is common in summary reports, where regions, months or products run across the top.

Here is a regional summary, with each region in its own column:

ABCDE
1RegionNorthSouthEastWest
2Sales4,2003,1005,6002,800
3Units1409518088

A normal sort would reorder rows 2 and 3, which isn't what you want. To rank the regions by sales, you need to move whole columns, keeping each region's sales and units together. That is a left-to-right sort.

If your data could just as well run down the page, it is often easier to flip it first. See how TRANSPOSE turns rows into columns.

How to sort left to right with the Sort dialog#

The Sort dialog can reorder columns in any version of Excel. Follow these steps on the table above:

  1. Select B1:E3. Leave out column A, because it holds the labels.
  2. Go to Data > Sort.
  3. Click Options…, choose Sort left to right and click OK.
  4. In Sort by, choose Row 2 (the Sales row).
  5. In Order, choose Largest to Smallest and click OK.

The result:

ABCDE
1RegionEastNorthSouthWest
2Sales5,6004,2003,1002,800
3Units1801409588

Each region kept its own sales and units. The steps are the same on a Mac: Data > Sort, then Options and Sort left to right.

Step 1 matters most. In a left-to-right sort, Excel has no "My data has headers" option for the label column, so if you select A1:E3, the words Region, Sales and Units are sorted along with the data. For more on the Sort dialog, see how to sort data in Excel.

How to sort horizontally with the SORT function#

The SORT function can sort columns too, and its result updates when the data changes. Set its fourth argument, by_col, to TRUE:

Excel formula
=SORT(array, [sort_index], [sort_order], [by_col])

For the regional table, type this in an empty cell such as B5:

Excel formula
=SORT(B1:E3,2,-1,TRUE)
  • B1:E3 is the data to sort, without the labels.
  • 2 is the row inside that range to sort by. Row 2 of B1:E3 is the Sales row.
  • -1 sorts largest first. Use 1 for smallest first.
  • TRUE sorts columns. If you leave it out, SORT sorts rows instead.

The result spills into B5:E7, starting with East in B5, then North, South and West. Type the labels Region, Sales and Units in A5:A7 next to it. SORT needs Excel 2021 or Microsoft 365. The SORT function guide lists every argument.

To sort the regions alphabetically by name instead, sort by row 1 in ascending order: =SORT(B1:E3,1,1,TRUE) returns East, North, South, West.

How to sort columns with SORTBY#

SORTBY sorts by a separate range, and when that range is a row, it sorts columns automatically. No by_col argument is needed:

Excel formula
=SORTBY(B1:E3,B2:E2,-1)

This gives the same result as the SORT formula: East, North, South, West. SORTBY is easier to read when the sort row sits outside the data, or when you want to sort by two rows. The guide to SORT and SORTBY compares the two in detail.

How to sort horizontally in a custom order#

Use a custom list when the order isn't alphabetical or numeric, such as North, South, East, West. In the Sort dialog, after choosing Sort left to right, open the Order drop-down and choose Custom List…. Type your order, one item per line, and click Add.

The custom sort guide explains custom lists, which work the same way for left-to-right sorts.

Why is my horizontal sort not working?#

Most problems come from the selection, not the sort itself. Check these:

  1. The label column was included. Undo with Ctrl+Z (Mac: ⌘Z), select only the data columns and sort again.
  2. Sort left to right wasn't chosen. Without it, Excel sorts rows. Open Options in the Sort dialog to check.
  3. Hidden columns. Excel doesn't move hidden columns in a left-to-right sort. Unhide them first.
  4. Merged cells. Excel can't sort a range with merged cells of different sizes. Unmerge them.
  5. Formulas that point outside the range. Relative references can break after sorting. Check totals afterwards.
  6. SORT without TRUE. =SORT(B1:E3,2,-1) sorts rows and gives a different result.

For more fixes, see why Excel sort is not working.

Sort or filter: which do you need?#

Sorting changes the order of the data. Filtering hides what you don't need. Excel's AutoFilter works on rows only, so for data laid out across columns, sorting with SORT or the Sort dialog is often the simpler tool. If you can turn the layout around so each item is a row, you get both: sort and filter in one table. The lesson on filtering a table shows how.

Practise it#

The SORT function is the quickest way to get a sorted copy, across or down. Practise SORT in a live spreadsheet: you type the formula and it checks it instantly. Then try the exercise on this page and sort the regions by sales with by_col set to TRUE.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Sort the regions from the highest to the lowest Sales. In B5, use SORT on B1:E3, sort by row 2, in descending order (-1), with TRUE as the last argument so it sorts columns.

fx
ABCDEF
1
Region
North
South
East
West
2
Sales
4200
3100
5600
2800
3
Units
140
95
180
88
4
5
6
7

Tip: SORT takes four parts here: the range, the row to sort by (2), the order (-1 for largest first) and TRUE to sort columns.

Practise this in a lesson

LessonSORT: order data with a formulaSort a table by any column, ascending or descending, and combine SORT with FILTER and UNIQUE.LessonFilter a tableTurn on filter buttons with Ctrl+Shift+L, filter by one or several values and by a number condition, total and count only the visible rows with SUBTOTAL, then clear the filters.Function guideSORTSort a range with a formula using Excel's SORT. Sort by any column, highest first, or combined with FILTER. Includes a live exercise.

Frequently asked questions

How do I sort columns left to right in Excel?

+

Select the columns to sort, go to Data > Sort, click Options and choose Sort left to right. Click OK, choose the row that holds the values to sort by in Sort by, pick an order and click OK.

Can the SORT function sort horizontally?

+

Yes. Set the fourth argument, by_col, to TRUE. For example, =SORT(B1:E3,2,-1,TRUE) sorts the columns of B1:E3 by row 2, largest first.

Why is Sort left to right greyed out or not working?

+

The option is inside the Sort dialog's Options button, not on the ribbon. If the sort scrambles your labels, you probably included the label column in the selection. Select only the data columns and try again.

How do I sort a row alphabetically in Excel?

+

Select the cells in the row, open Data > Sort > Options, choose Sort left to right, then sort by that row from A to Z. With a formula, use =SORT(B1:E1,1,1,TRUE).

Sources

  • Sort data in a range or table - Microsoft Support
  • SORT function - Microsoft Support
  • SORTBY function - Microsoft Support

Written and checked by the ExcelReady Team. First published November 3, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. When do you need to sort horizontally?
  2. How to sort left to right with the Sort dialog
  3. How to sort horizontally with the SORT function
  4. How to sort columns with SORTBY
  5. How to sort horizontally in a custom order
  6. Why is my horizontal sort not working?
  7. Sort or filter: which do you need?
  8. Practise it

Keep reading

Data tools· 6 min read

How to Sort Data in Excel by One or More Columns

To sort data in Excel by one column, click any cell in that column and choose Data > Sort A to Z or Sort Z to A. To sort by several columns, choose Data > Sort, pick the first column, then click Add Level for the next one. Click a single cell first so Excel keeps each row together.

Data tools· 5 min read

Custom Sort in Excel: Sort by Your Own Order

To do a custom sort in Excel, go to Data > Sort, choose the column in Sort by, and set Order to Custom List. Type your order, such as High, Medium, Low, click Add and then OK. Excel sorts the rows in that order instead of alphabetically. With a formula, use =SORTBY(A2:C9,MATCH(B2:B9,E2:E4,0)), where E2:E4 holds the order.

Dynamic arrays· 6 min read

SORT and SORTBY in Excel

SORT returns a sorted copy of a range: =SORT(A2:C9,3,-1) sorts by the 3rd column, largest first. SORTBY sorts one range by the values in another, so the column you sort by doesn't have to be in the result, and it handles several sort levels. Both leave the original data unchanged and need Excel 2021, Excel 2024 or Microsoft 365.

More on data tools

  • Sparklines in Excel: Tiny Charts Inside Cells
  • Structured References in Excel Tables, Explained
  • SUBTOTAL in Excel: Totals That Ignore Filtered Rows
  • How to Sum the Same Cell Across Sheets in Excel
  • Summarize Data Without a Pivot Table
  • How to Make a Sunburst Chart in Excel for Nested Categories
All data tools articles →

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free