How to Sort Excel Data Horizontally from Left to Right
Question details
The user wants to know how to sort data horizontally across columns rather than vertically across rows in a spreadsheet.
- Product
- Excel
- Device & OS
- not provided
- Scenario
- Organizing spreadsheet data horizontally.
- Observed behavior
- The user needs to change the default vertical sort orientation to sort left-to-right based on specific row values.
Ensure that your dataset does not contain any merged cells in the range you intend to sort, as merged cells will prevent the sorting function from executing properly.
Change Sort Orientation to Left to Right
Adjust the built-in sort orientation settings in the Data tab to sort data across columns.
By default, spreadsheet applications sort data from top to bottom (vertically). However, you can easily change the orientation in the Sort dialog box to sort data across columns (horizontally). This is particularly useful when you have a wide dataset organized row by row.
Highlight the specific range of cells you want to sort. Be sure not to select row headers if you want them to remain in place on the left.
Navigate to the 'Data' tab on the top ribbon menu and click on the 'Sort' button to open the custom sorting window.
Click the 'Options...' button located at the top of the Sort dialog box. Under the 'Orientation' section, select the 'Sort left to right' radio button and click 'OK'.
In the 'Sort by' dropdown menu, select the specific Row index you want to base your sort on. Choose your desired sorting order (such as A to Z, or Z to A), and click 'OK' to apply the changes.
Sort Data Horizontally with WPS Spreadsheet
WPS Spreadsheet provides a seamless and user-friendly way to organize your data. You can easily switch between vertical and horizontal sorting to arrange your rows and columns exactly as needed without relying on complicated formulas.
- 1. Open your file in WPS Spreadsheet: Launch WPS Office and open your workbook containing the data to be sorted.
- 2. Select the target data: Highlight the range of cells you want to sort horizontally with your mouse.
- 3. Access Custom Sort: Navigate to the Data tab on the main ribbon, click the Sort icon, and choose Custom Sort from the drop-down menu.
- 4. Apply Left to Right sorting: In the Custom Sort window, click Options, select 'Sort left to right', set your primary row criteria, and click OK to rearrange your columns.

Frequently Asked Questions
Why is the 'Sort left to right' option not sorting my headers correctly?
If your column headers are included in the selected range, they will be sorted along with the rest of the data. To prevent headers from moving, do not highlight the row containing your column labels when selecting the range to sort.
Why is my Sort option greyed out or returning an error?
This typically happens if your selected range includes merged cells, or if you are attempting to sort within a formatted Excel Table. You must unmerge any merged cells or convert the Excel Table to a standard range before performing a horizontal sort.
Can I sort multiple rows horizontally at the same time?
Yes. After selecting 'Sort left to right' in the Options menu, click 'Add Level' in the Sort dialog box. This allows you to sort by a primary row first, and then sort any duplicate values using a secondary row.




