How to Flip Data Horizontally in Excel (3 Effective Methods)

You are at the perfect place if you are looking to flip data horizontally in Excel. In this post, we have covered several simple techniques to flip data horizontally. Consequently, stick with us and follow the instructions.


Download Practice Workbook

You can download the practice workbook from the following download button.


3 Methods to Flip Data Horizontally in Excel

Assume that you have a table as shown below and you want to flip this data horizontally.

3 Methods to Flip Data Horizontally in Excel

Or, you have a dataset like the below image. In this article, we are going to solve the problem conveniently.

3 Methods to Flip Data Horizontally in Excel


1. Apply Sort Command to Flip Data Horizontally in Excel

In the first method, we are going to sort horizontally with the simple built-in Sort command under the Data tab. Just expressed in the images below.

📌 Steps:

  • Select any cell in the dataset. 

Apply Sort Command to Flip Data Horizontally in Excel

  • After hitting the Sort, this pop-up will appear and then we will follow the steps shown lower down. As we want to flip data horizontally, we have to click Options… 

Apply Sort Command to Flip Data Horizontally in Excel

  • After that check ‘Sort left to right’ and hit ‘OK’.

Sort Left to Right

  • Now, as in step:1, we have selected data that we want to sort. Then, we choose the Row Sort by(Age in Row 5) option in step:2 and like in step:3, order (Smallest to Largest) and press the button ‘OK’.

Apply Sort Command to Flip Data Horizontally in Excel

  • And we have got the ascending order of ages of some people all over the world. 

Final Table

Read More: How to Flip Data from Horizontal to Vertical in Excel (6 Methods)


Similar Readings


2. Transpose Twice and Sort with a Helper Command

In many cases, we will not have the data shown in Method 1. If not, we will transpose the data table and then sort it with our requirement and after that, we will again transpose to get our original dataset but this time with a sorted version. 

📌 Steps:

  • First of all, we will select the table and then press Ctrl+C (Copy the table) and select a cell with a mouse right click and then go to Paste Special…

Transpose

  • Now we will add a Helper Column in the last column of the table as shown in the image below.

transpose

  • We again transpose this data table by copy (Ctrl+C) and Paste Specials (where the transpose option is available)

Starting Sort

  • Additionally,  we will go through the steps as shown in the below image. In the first step, we will select the data we prefer to sort. After that, we will go to Sort under the Data tab.

Sort Option

  • We then select Sort By (in this case COLUMN O) and Order (Largest to smallest) and click ‘OK’ .

Repeat Transpose

  • Once again, we again transpose this data table by copy (Ctrl+C) and Paste Specials (where the transpose option is available)

Check Transpose Box

  • Now we got the table that we started our journey with but in this case from largest to smallest ages.

Final Table

Read More: How to Flip Columns and Rows in Excel (2 Easy Methods)


3. Use VBA Code to Flip Data Horizontally

If you are a VBA freak like me, you may not oppose using a VBA code to flip data! Just execute the following simple steps.

📌 Steps:

  • Select the table that is required to flip.

Sample Data

  • Then press Alt+F11 and the box shown below will appear.

VBA Pop up

  • Copy the below VBA code below and paste it into the pop-up dialogue box. And hit F5.
Sub FlipDataHorizontally()
    Dim xRng As Range
    Dim WrkRng As Range
    Dim ArY As Variant
    Dim i As Integer, j As Integer, k As Integer
    On Error Resume Next
    xTitleId = "Horizontally Flipping Data "
    Set WrkRng = Application.Selection
    Set WrkRng = Application.InputBox("Range", xTitleId, WrkRng.Address, Type:=8)
   ArY = WrkRng.Formula
    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual
    For i = 1 To UBound(ArY, 1)
        k = UBound(ArY, 2)
        For j = 1 To UBound(ArY, 2) / 2
            xTemp = ArY(i, j)
           ArY(i, j) = ArY(i, k)
           ArY(i, k) = xTemp
            k = k - 1
        Next
    Next
   WrkRng.Formula = ArY
    Application.ScreenUpdating = True
    Application.Calculation = xlCalculationAutomatic
End Sub
  • The flipped table will be the image shown below.

Use VBA Code to Flip Data Horizontally

Read More: How to Flip Rows in Excel (4 Simple Methods)


Conclusion

I hope these strategies will simplify your projects or jobs. Additionally, if you aspire to master this topic, you may download the workbook and use it for your own practice. Please let me know in the comment section if you have any queries, concerns, or suggestions. For more such content, please visit our blog ExcelDemy.


Related Articles

Al Ikram Amit

Al Ikram Amit

Hi there. I am Amit, completed my study from BUET. Currently, i am working as an Excel & VBA Content Developer at ExcelDemy. Now you can see my articles in ExcelDemy blog.

We will be happy to hear your thoughts

Leave a reply

ExcelDemy
Logo