Move Columns by Sorting Left to Right


September 18, 2023 - by

Move Columns by Sorting Left to Right

Problem: My IT department produces a report every day, and the columns are in the wrong sequence. It would take them two minutes to rewrite the query, but they have a six-month backlog and don’t have time to get around to it. How can I rearrange the columns?

Columns are in the "wrong" sequence
Figure 1325. The columns are not in a logical sequence.

Strategy: You can sort the columns left-to-right. The quick way is to add a new row with column sequence numbers. If you really have to rearrange these every day, however, it would make sense to add a custom list with the proper sequence of the columns.


Follow these steps for the quick method:

  • 1. Insert a new row above the headings.



  • 2. In the new row, enter the numbers 1 through n to specify the desired sequence for the columns. If you want company name first, number that column 1, and so on.

  • 3. Select the range of data to be sorted. Use Ctrl+* to select the current range. If you don’t explicitly select the whole range, the Sort command tends to remove the numbered row 1 from the sort.

Add a new row 1 with column numbers. Mark the column that should be on the left as 1, followed by 2, and so on. In the Sort dialog box, choose Options, then Sort Left to Right.  Sort by Row 1.
Figure 1326. Steps 2, 3, 6, and 7 are all shown here.
  • 4. Select Data, Sort.

  • 5. Click the Options button at the top of the Sort dialog.

  • 6. Choose Sort Left to Right under Orientation. Click OK to close the Sort Options dialog.

  • 7. In the Sort By dropdown, choose Row 1.

  • 8. Click OK to rearrange the columns.

  • 9. Because the column widths do not sort with the data, select Home, Format dropdown, AutoFit Column Width to fix all column widths. The columns are rearranged.

  • 10. You can now delete the temporary row 1.

Alternate Strategy: If you defined a custom list of Company, Attn:, Address, Suite, City, State, Zip, you could skip the first two steps above. When defining the sort, you would specify Company, Attn:, Address as the sequence. For information on defining a custom sort sequence, see .


This article is an excerpt from Power Excel With MrExcel

Title photo by Nick Fewings on Unsplash