To sort columns from left to right in Google Sheets, select the range, choose Data > Sort range > Advanced range sorting options, turn on Sort left to right, then choose the row to sort by and the order. Sheets moves the selected columns together, so values in the other selected rows stay with their columns.
What horizontal sorting does
A normal sort orders rows from top to bottom. A horizontal sort does the reverse: it rearranges columns from left to right according to the values in one row. It is useful when each column represents a period, location, product, or other item and you want those items ordered by a value or label.
For example, imagine a table with months across the top and sales and returns in the rows below. Sorting by the month row can put the months in date order while moving each month’s sales and returns with it. This is different from sorting just the month labels: a proper range sort moves the entire selected column of related values together.
Sort a range from left to right
Use these steps in Google Sheets in a web browser:
- Select the full range whose columns need to move. Include every row of data that must stay aligned, and leave out unrelated cells.
- Open Data > Sort range > Advanced range sorting options.
- In the dialog, enable Sort left to right.
- Choose the row containing the sort key, then choose an order such as A to Z or Z to A. For numbers or dates, choose ascending or descending as appropriate.
- Click Sort and check that the headings and their associated values are still together.
The row choice is made within the selected range. If the selected range begins at row 5, for example, its first row is the first available sort row in that range. Select carefully: omitting a data row means it will not move with the rest of the columns.
Choose the right range and sort row
The sort range is just as important as the sort key. Suppose A1 contains a row label, while B1:G1 contains month names and B2:G3 contain sales and returns. Select B1:G3 to reorder the months and their values while leaving the labels in column A in place. If you select only B1:G1, the month names will move but the numbers below them will not, which breaks the relationship between headings and data.
Before sorting, decide what one movable unit represents. If each column is a complete record, include all of that record’s fields in the selected range. If columns are time periods and the row labels at the left describe the measures, include the period columns and all measure rows, but normally exclude the label column.
- Sort by a name row to alphabetize column headings.
- Sort by a date row to put periods in chronological order.
- Sort by a numeric row to rank columns by a measure such as revenue or quantity.
Ascending, descending, and mixed values
Ascending order generally puts text from A to Z and numbers from smallest to largest; descending reverses the order. Dates sort chronologically when Sheets recognizes the cells as dates. A date that is stored as plain text may instead sort like text, so check the cell format and the underlying values if the result looks unexpected.
Blanks and mixed data types can also affect how an order appears. If a sort row contains numbers, words, and empty cells, inspect the result rather than assuming the values will follow the order you intended. A clean sort key—one consistent type of value per cell—makes the outcome easier to predict. For a ranking, make sure the chosen row contains the actual measure, not a label or a formula that returns text unexpectedly.
Use a formula when you need a separate sorted copy
A menu sort changes the original range. If you want a sorted result elsewhere while keeping the source untouched, you can transpose the data, sort the transposed rows, and transpose it back. This is most useful for a compact range where the first row contains the key. The formula result is an array, so leave enough empty cells to its right and below.
With the source data in A1:C3, row 1 containing Pear, Apple, and Orange, and rows 2–3 holding each item’s related values, enter this in an empty area such as E1:
=TRANSPOSE(SORT(TRANSPOSE(A1:C3),1,TRUE))
The result orders the columns by the values in the original first row: Apple, Orange, Pear. The values originally beneath Apple, Orange, and Pear move with their respective headings. In the inner SORT function, 1 means sort by the first column of the transposed data—which corresponds to the original first row—and TRUE requests ascending order. Use 2 instead of 1 to sort by the original second row. The source remains unchanged, but an occupied cell in the output area can prevent the array from expanding.
What happens to formulas and other sheet features
When you sort a range through the menu, Sheets reorders the selected cells; formulas and values inside that range move along with them. References inside formulas can behave differently depending on how they were written, so inspect important formulas after a rearrangement, especially if they refer to cells outside the sorted range. A formula-generated sorted copy updates from its source rather than rearranging the source cells.
Formatting in the selected cells generally moves with those cells, while formatting or content outside the range does not. That is another reason to select the whole set of related data. Merged cells, protected cells, or a range that overlaps other structured data can complicate editing or prevent the intended sort. If Sheets reports an issue, check for merged cells and permissions, and try selecting a clean rectangular range containing only the data to be reordered.
Common mistakes and how to fix them
- Only the key row moved: select the full rectangle, not just the row containing the sort values.
- A label column was left behind: that may be correct for row labels, but not if the first column is part of each record. Reconsider the range based on what should travel together.
- The wrong row determined the order: confirm the row number shown in the sort dialog and the range’s starting point.
- Dates appear out of sequence: check whether they are real date values rather than text strings, and use a consistent date format.
- The formula result will not appear: clear cells blocking its spill area and confirm that the referenced range is correct.
- Other data changed unexpectedly: undo promptly with Ctrl+Z on Windows or Chromebook, or Command+Z on Mac, then repeat with a more precise selection.
For important sheets, make a copy before reorganizing a large table. Sorting is not the same as filtering: a filter hides rows that do not match criteria, while a horizontal sort changes the left-to-right order of the selected columns.
Horizontal sorting compared with alternatives
Use the built-in range sort when you want to rearrange the original data and keep each selected column intact. Use the TRANSPOSE and SORT formula approach when you need a live, separate view and can reserve a clear output area. For a quick one-off reordering of a few columns, dragging columns may seem simpler, but it is easier to misplace a column or move only part of a dataset. A range sort is generally safer when multiple rows of values must stay aligned.
Google Sheets’ SORT function is designed to sort rows using a column in its input. It does not provide a direct left-to-right switch; transposing before and after SORT is the workaround for a formula-driven horizontal result. Excel has its own sort dialog and orientation options, so do not assume the Google Sheets menu names or exact steps are identical there.
Frequently Asked Questions
Can Google Sheets sort columns left to right?
Yes. Select the data range, open Data > Sort range > Advanced range sorting options, enable Sort left to right, and choose the row and sort order.
How do I sort columns alphabetically by the top row?
Select the complete range to be reordered, enable Sort left to right in the advanced range options, and choose the top row within that selection as the sort key. Include the related rows so they move with the headings.
Can I sort horizontally without changing the original data?
Yes. Use a formula in a separate, empty area that transposes the source, sorts it, and transposes it back. The formula returns a separate result; it does not rearrange the source cells.
Why did only my headings move?
You probably selected only the heading row. Undo the sort, select the headings and every associated data row, then run the horizontal sort again.
Can I sort horizontally by a row other than the first one?
Yes. In the sort dialog, choose the row containing the values to sort by. With the formula method, the SORT index refers to the corresponding row in the original range after transposition; for example, 2 sorts by the original second row.
Related
- Insert an Editable Checkbox in Word: A Step-by-Step Guide
- Insert an Electronic Signature in Word
- Insert an E-Signature in Word: Steps and Options
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- How to Set Out of Office in Outlook on Your DevicesTo set an out-of-office message in Outlook, open Automatic Replies, switch them on, write your message, and—if you…
- How to Clear Browser Cache in Outlook on the Web SafelyTo clear the browser cache for Outlook on the web, open your browser’s privacy settings and delete cached…
- Set Vacation Out of Office in Outlook: Setup and TipsTo set a vacation out-of-office reply in Outlook, open Automatic Replies, turn them on, choose your dates, write…
- SUMIF Negative Values in Google Sheets: Formula & TipsTo add only negative numbers in Google Sheets, use =SUMIF(B2:B100,"<0"), replacing B2:B100 with the range containing your numbers.…
- How to Create a Checkbox in Google Sheets (and Use It)To create a checkbox in Google Sheets in a web browser, select the cell or range where you…
- Excel Table Color Not Changing? Common Causes and FixesIf an Excel table’s color is not changing, select a cell inside the table, open Table Design, and…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.