Now, if you’re thinking that there must be an inbuilt feature to do this in Excel, I’m afraid you’d be disappointed. While there are multiple ways you can flip the data in Excel, there is no inbuilt feature. But you can easily do this using simple a sorting trick, formulas, or VBA. In this tutorial, I will show you how to flip the data in rows, columns, and tables in Excel. So let’s get started!

## Flip Data Using SORT and Helper Column

One of the easiest ways to reverse the order of the data in Excel would be to use a helper column and then use that helper column to sort the data.

### Flip the Data Vertically (Reverse Order Upside Down)

Suppose you have a data set of names in a column as shown below and you want to flip this data: Below are the steps to flip the data vertically: The above steps would sort the data based on the helper column values, which would also lead to reversing the order of the names in the data. Once done, feel free to delete the helper column. In this example, I’ve shown you how to flip the data when you just have one column, but you can also use the same technique if you have an entire table. Just make sure that you select the entire table and then use the helper column to sort the data in descending order.

### Flip the Data Horizontally

You can also follow the same methodology to flip the data horizontally in Excel. Excel has an option to sort the data horizontally using the Sort dialog box (the ‘Sort left to right’ feature). Suppose you have a table as shown below and you want to flip this data horizontally. Below are the steps to do this: The above steps would flip the entire table horizontally. Once done, you can remove the helper row.

## Flip Data Using Formulas

Microsoft 365 has got some new formulas that make it really easy to reverse the order of a column or a table in Excel. In this section, I’ll show you how to do this using the SORTBY formula (if you’re using Microsoft 365), or the INDEX formula (if you’re not using Microsoft 365)

### Using the SORTBY function (available in Microsoft 365)

Suppose you have a table as shown below and you want to flip the data in this table: To do this, first, copy the headers and place them where you would want the flipped table Now, use the following formula below the cell in the left-most header: The above formula sorts the data and by using the result of the ROW function as the basis to sort it. The ROW function in this case would return an array of numbers that represents the row numbers in between the specified range (which in this example would be a series of numbers such as 2, 3, 4, and so on). And since the third argument of this formula is -1, it would force the formula to sort the data in descending order. The record that has the highest row number would come at the top and the one which has the lowest rule number would go at the bottom, essentially reversing the order of the data. Once done, you can convert the formula to values to get a static table.

### Using the INDEX Function

In case you don’t have access to the SORTBY function, worry not – you can use the amazing INDEX function. Suppose you have a dataset of names as shown below and you want to flip this data. Below is the formula to do this: How does this formula work? The above formula uses the INDEX function that would return the value from the cell based on the number specified in the second argument. The real magic happens in the second argument where I have used the ROWS function. Since I have locked the second part of the reference in the ROWS function, in the first cell, it would return the number of rows between A2 and A12, which would be 11. But when it goes down the rows, the first reference would change to A3, and then A4, and so on, while the second reference would remain as is because I have locked it and made it absolute. As we go down the rows, the result of the ROWS function would decrease by 1, from 11 to 10 to 9, and so on. And since the INDEX function returns us the value based on the number in the second argument, this would ultimately give us the data in the reverse order. You can use the same formula even if you have multiple columns in the data set. however, you will have to specify a second argument that would specify the column number from which the data needs to be fetched. Suppose you have a data set as shown below and you want to reverse the order of the entire table: Below is the formula that will do that for you: This is a similar formula where I’ve also added a third argument that specifies the column number from which the value should be fetched. To make this formula dynamic, I have used the COLUMNS function that would keep on changing the column value from 1 to 2 to 3 as you copy it to the right. Once done, you can convert the formulas to values to make sure that you have a static result.

## Flip Data Using VBA

If flipping the data in Excel is something you have to do quite often, you can also try the VBA method. With a VBA macro code, you can copy and paste it once within the workbook in the VBA editor, and then reuse it over and over again in the same workbook. You can also save the code in the Personal Macro Workbook or as an Excel add-in and be able to use it in any workbook on your system. Below is the VBA code that would flip the selected data vertically in the worksheet. To use this code, you first need to make the selection of the data set that you want to reverse (excluding the headers), and then run this code. How does this code work? The above code first counts the total number of rows in the data set and assigns that to the variable EndNum. It then uses the Do While loop where the sorting of the data happens. The way it sorts this data is by taking the first and the last row and swapping these. It then moves to the 2nd row in the second last row and then swaps these. Then it moves to the third row in the third last row and so on. The loop ends when all the sorting is done. It also uses the Application.ScreenUpdating property and sets it to FALSE while running the code, and then turn it back to TRUE when the code has completed running. This ensures that you don’t see the changes happening in real-time on your screen it also speeds up the process. How to use the Code? Follow the below steps to copy and paste this code in the VB Editor: To run the VBA macro code, first select the dataset that you want to flip (excluding the headers). With the data selected, go to the VB Editor and click on the green play button in the toolbar, or select any line in the code and then hit the F5 key So these are some of the methods you can use to flip the data in Excel (i.e., reverse the order of the data set). All the methods that I have covered in this tutorial (formulas, SORT feature, and VBA), can be used to flip the data vertically and horizontally (you’ll have to adjust the formula and VBA code accordingly for horizontal data flipping). I hope you found this tutorial useful. Other Excel tutorials you may also like:

How to Sort by the Last Name in Excel (Easy Guide)How to Sort By Color in Excel (in less than 10 seconds)How to Sort Worksheets in Excel using VBA (alphabetically)How to do a Multiple Level Data Sorting in Excel