How to Reverse Column Order in Excel: 4 Useful Methods

Method 1 – Use Sort Feature to Reverse Column Order in Excel

Steps:

  • Select the Helper Column.

Use Sort Feature to Reverse Column Order in Excel

  • Go to the Data On the Sort and Filter group, choose Sort Largest to Smallest, shown by the red color box in the figure below.

Use Sort Feature to Reverse Column Order in Excel

  • After clicking this, a new window will pop up like this below.

  • Choose Expand the selection and click You will get the following result.

  • See that the column order has been reversed. Now Shampo is on the top, and Soap is on the bottom.
  • We don’t need the Helper Column anymore, we can delete the extra column and get our clean result like this below.

Use Sort Feature to Reverse Column Order in Excel


Method 2 – Combine SORTBY and ROW Functions to Reverse Column Order in Excel

Another good approach or reverse column in Excel combines the SORTBY and the ROW functions. The ROW function gives an array of row numbers of selected cells. On the other hand, the SORTBY function sorts the contents of a range or array based on the values in a corresponding range or array.

The formula that we will use is below:

=SORTBY(B4:C8,ROW(B4:B8),-1)
  • B4: C8 is the array that will be reversed/sorted.
  • ROW(B4:B8) will give the row number of product.
  • -1 is for sorting the data in descending order.

To apply this formula, follow the steps below.

Steps:

  • Let’s create a header column for reversed ordered data like this.

Use SORTBY and ROW Function to Reverse Column in Excel.

  • In cell E4, Input the formula mentioned above.

Use SORTBY and ROW Function to Reverse Column in Excel.

  • Click Enter, and you will see the following result.

Use SORTBY and ROW Function to Reverse Column in Excel.

Note: Only the cell values are duplicated, not the cell format. So you have to adjust the cell format manually. After formatting the cell, the result will be like the one below.

Use SORTBY and ROW Function to Reverse Column in Excel.


Method 3 – Merge INDEX, ROWS, and COLUMNS Functions to Reverse Column Order

Steps:

  • Copy the two header cells and paste them into cells E3 and F3.

Merge INDEX, ROWS, and COLUMNS Functions to Reverse Column Order

  • In E4, Write down the following formula:
=INDEX($B$4:$C$8,ROWS(B4:$B$8),COLUMNS($B$4:B4))
  • COLUMNS($B$4:B4): Search and return the specified cell reference column number.
  • ROWS(B4:$B$8): Looks up and returns the number of rows in each reference or array.
  • INDEX($B$4:$C$8,ROWS(B4:$B$8),COLUMNS($B$4:B4)): This will take the whole range of data and then reverse the columns.
  • Now press Enter. You will get the following result.

Merge INDEX, ROWS, and COLUMNS Functions to Reverse Column Order

Drag the Fill Handle down to duplicate the formula over the range. To AutoFill the range, double-click on the Plus (+) symbol, as shown in the figure below.

Merge INDEX, ROWS, and COLUMNS Functions to Reverse Column Order

You will see that the cells below have been filled with product names in reversed order.

  • To replicate the formula throughout the range, drag the Fill Handle rightwards like below.

  • Now you will see that the Price has also been reversed in the right column.

Merge INDEX, ROWS, and COLUMNS Functions to Reverse Column Order

  • Like method 2, it also doesn’t give you the cell format. You have to do it manually.

Method 4 – Run a VBA Macro Code to Reverse Column Order

Steps:

Apply VBA Macro to Reverse Column Order in Excel

  • A new window will pop up. In this window, click on Insert and select Module.

Apply VBA Macro to Reverse Column Order in Excel

  • You will see a window like this.

  • Copy the code below and paste it into the window.
 Sub Reverse_Columns()
    Dim Rg As Range
    Dim WRg As Range
    Dim Ar As Variant
    Dim a As Integer, b As Integer, c As Integer
    On Error Resume Next
    xTitleId = "Reverse columns"
    Set WRg = Application.Selection
    Set WRg = Application.InputBox("Range", xTitleId, WRg.Address, Type:=8)
    Ar = WRg.Formula
    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual
    For b = 1 To UBound(Ar, 2)
        c = UBound(Ar, 1)
            For a = 1 To UBound(Ar, 1) / 2
                xTemp = Ar(a, b)
                Ar(a, b) = Ar(c, b)
                Ar(c, b) = xTemp
                c = c - 1
            Next
    Next
    WRg.Formula = Ar
    Application.ScreenUpdating = True
    Application.Calculation = xlCalculationAutomatic
End Sub

  • Run the code by pressing the F5 key. A window will appear like this.

Apply VBA Macro to Reverse Column Order in Excel

  • You must select the cell range from B4 to C8 and click OK. You will get the following result.

Apply VBA Macro to Reverse Column Order in Excel

You can see that we have got our desired result. Here Shampo is at the top, and Soap is at the bottom of the list.


Things to Remember

  • The first method is the easiest and fastest among the four methods.
  • The 2nd and 3rd methods don’t copy the cell format. So you have to manually adjust it.
  • If your works require reversing column order frequently, then you should consider the 4th method of using VBA code.

Download Practice Workbook

Download this practice workbook to exercise while you are reading this article.


Related Articles


<< Go Back to Excel Reverse Order | Sort in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Aniruddah Alam
Aniruddah Alam

Md. Aniruddah Alam, a graduate of Bangladesh University of Engineering & Technology, Dhaka, holds a BSc.Engg in Naval Architecture & Marine Engineering. Joining Softeko in August 2022 as an Excel and VBA content developer, he has authored 90+ articles, covering fundamental to advanced Excel topics. He actively develops VBA codes for Excel automation and offers solutions in the Exceldemy Forum. Beyond work, he finds leisure in reading books, and taking relaxing walks, showcasing well-rounded blend of professional and... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo