Excel Reverse Order (Table of Contents)
- Using the Sort Method
- Using Excel Formula
- Using VBA Code
Reverse Order of Excel Data
Manipulation of data in Excel is a common thing for those who work regularly with data with excel. We need to play around with data to make sure that data is organized as per our convenience. When it comes to arranging the data “reverse order” is something we need to learn because it is such a useful technique in our workplace. In this article, we will show you how to reverse the order of data in excel.
The reverse order is nothing but flipping the data where the bottom value comes on top and top value goes to the bottom. For an example look at the below image.
As we can see bottom value is at the top in the reverse order and same goes to top value as well. So, how do we reverse the order of data in excel is the question now.
How to Reverse the Order of Data Rows in Excel?
In excel we can Sort by following several ways, in this article we will show you all the possible ways to reverse the order in excel.
Method #1 – Simple Sort Method
You must be already wondering is it possible to reverse the excel data by just using a sort option. We cannot reverse just by sorting the data but with some helper column, we can actually do this.
Consider the below data for this example.
Next to this create a column called “HELPER” and insert serial numbers.
Now select the entire data and open sort option by pressing ALT + D + S.
Under “Sort by” choose “Helper”.
Then under “Order” choose “Largest to Smallest”.
Now click on Ok, our data will be reversed.
Method #2 – Using Excel Formula
We can also reverse the order by using formulas as well. Even though we don’t have any built-in function to do this we can make use of other formulas to reverse the order.
To make the reverse order of excel data we are going to use two formulas i.e. INDEX and ROWS. INDEX Function can fetch the result from the mentioned row number of the selected range and ROWS function will give the count of a number of selected rows.
Consider the below data for this example.
Open INDEX function first.
For Array select the city names from A2: A9 and make it absolute reference by pressing F4 key.
Next, to insert Row Num open ROWS function inside the INDEX function.
For ROWS function select the same range of cells as we have selected for INDEX function but this time only make the last cell as an absolute reference.
Close the bracket and hit enter key to get the result.
Drag the formula to get the full result.
Method #3 – Reverse Order by Using VBA Coding
Reversing the order of excel data is also possible by using VBA Coding. If you have good knowledge of VBA then below is the code for you.
Sub Reverse_Order() Dim k As Long Dim LR As Long LR = Cells(Rows.Count, 1).End(xlUp).Row For k = 2 To LR Cells(k, 2).Value = Cells(LR, 1).Value LR = LR - 1 Next k End Sub
Copy this code to your module.
Now run the code to get the reverse order list in your excel worksheet.
Let me explain to you how this code works for you. First I have declared two variables “k” & “LR” as a LONG data type.
Dim k As Long Dim LR As Long
“k” is for looping through cells and “LR” is to find the last used row in the worksheet.
Next, I have used finding the last used row technique to find the last value in the string.
LR = Cells(Rows.Count, 1).End(xlUp).Row
Next, I have employed FOR NEXT loop to loop through the cells to reverse the order.
For k = 2 To LR Cells(k, 2).Value = Cells(LR, 1).Value LR = LR - 1 Next k
So when we run this code we get the following result.
Like this using several ways we can reverse the order in excel.
Things to Remember
- There is no built-in function or tool available in excel to reverse the order.
- Combination of INDEX + ROWS will reverse the order.
- Off all the available techniques sort option is the better and easy way to sort.
- To understand VBA code you need to have prior knowledge of VBA macros.
This has been a guide to Excel Reverse Order. Here we discuss how to reverse order of data using 1) Sort Method 2) Excel Formula 3) VBA Code. You can learn more from the following articles –
- How to do Pivot Table Sort?
- How to Column Sort in Excel?
- How to Sort by Number in Excel?
- How to Sort by Color in Excel?
The post Excel Reverse Order appeared first on .