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

Get FREE Advanced Excel Exercises with Solutions!

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.

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

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

## 1. Using 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.Â

• 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â€¦Â

• After that check â€˜Sort left to rightâ€™ and hit â€˜OKâ€™.

• 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â€™.

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

## 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 to copy >> select a cell with a mouse right-click >> then go to Paste Specialâ€¦

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

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

• 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.

• We then select Sort By (in this case COLUMN O) and Order (Largest to smallest) and click â€˜OKâ€™.

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

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

Read More: How to Flip Table in Excel

## 3. Applying Excel 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.

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

• 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.

## 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.Â

## Related Articles

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

## What is ExcelDemy?

ExcelDemy - Learn Excel & Get Excel Solutions Center provides online Excel training , Excel consultancy services , free Excel tutorials, free support , and free Excel Templates for Excel professionals and businesses. Feel free to contact us with your Excel problems.
Al Ikram Amit

Al Ikram Amit, holding a BSc in Naval Architecture & Engineering from Bangladesh University of Engineering and Technology, serves as a key Excel & VBA Content Developer at ExcelDemy. Driven by a profound passion for research and innovation, he actively immerses himself in Excel. In his role, Amit not only skillfully addresses complex challenges but also exhibits enthusiasm and expertise in gracefully navigating tough situations, emphasizing his steadfast commitment to consistently delivering exceptional, high-quality content that adds significant... Read Full Bio

We will be happy to hear your thoughts

Advanced Excel Exercises with Solutions PDF