Flip a Column of Data Vertically

This post will guide you how to flip a column of data vertically preserving the original formatting and formulas in Excel. How do I reverse a column of data order in a column arranged alphabetically or from largest to smallest. How to use the Excel Sort feature to reverse the data order? Or how to use a VBA macro code to flip a column of data vertically in Excel.

If you want to flip or reverse a column of data that is already in numeric or alphabetical order, and you can easily to flip it with Sort feature. And if the column data is not sorted and you can try to create a helper column to achieve the result.

Flip a Column of Data with Sort Feature

#1 select the column that you want to flip, right click on it, and select Insert to add helper column. Choose Entire column radio button. Then insert 1,2,3,4,…in helper column.

flip column data

flip column data2

flip column data3

#2 select your helper column, then go to the Data tab, click the Sort Largest to Smallest command under Sort&Filter group.

flip column data4

#3 you will see that the numbers in help column will be sorted and the data of column also be reversed. Now you can delete the help column. Or you can also hide the help column in case you want to restore the data of column.

flip column data5

flip column data6

#4 let’s see the result

flip column data7

Flip a Column of Data Vertically with Function

You can also create an excel formula based on the INDEX function and the ROWS function to flip a column of data vertically. Type the following formula in the formula box of cell C1, then press enter key.

=INDEX($B$1:$B$4,ROWS(B1:$B$4))

Let’s see the result as below:

flip column data8

Flip a Column of Data Vertically with VBA Macro

You can also write an Excel VBA Macro to flip a column of data vertically quickly. Just do the following steps:

#1 click on “Visual Basic” command under DEVELOPER Tab.

Get the position of the nth using excel vba1

#2 then the “Visual Basic Editor” window will appear.

#3 click “Insert” ->”Module” to create a new module.

convert column number to letter3

#4 paste the below VBA code into the code window. Then clicking “Save” button.

flip column data9

Sub FlipCol()
    Dim R As Range
    Dim W As Range
    Dim A As Variant
    Dim i As Integer
    Dim j As Integer
    Dim k As Integer
    On Error Resume Next
    titleS = "Flip data in a column"
    Set W = Application.Selection
    Set W = Application.InputBox("select a range that you want to reverse", titleS, W.Address, Type:=8)
    A = W.Formula
    For j = 1 To UBound(A, 2)
        k = UBound(A, 1)
        For i = 1 To UBound(A, 1) / 2
            xTemp = A(i, j)
            A(i, j) = A(k, j)
            A(k, j) = xTemp
            k = k - 1
        Next
    Next
    W.Formula = A
End Sub

#5 back to the current worksheet, then run the above excel macro. Click Run button.

flip column data10

#6 select a range that you want to flip.

flip column data11

#7 click OK button, then check the result.

flip column data12


Related Functions

  • Excel INDEX function
    The Excel INDEX function returns a value from a table based on the index (row number and column number)The INDEX function is a build-in function in Microsoft Excel and it is categorized as a Lookup and Reference Function.The syntax of the INDEX function is as below:= INDEX (array, row_num,[column_num])…
  • Excel ROWS function
    The Excel ROWS function returns the number of rows in a cell reference.The syntax of the ROWS function is as below:= ROWS(array)…
Related Posts
VBA Macro For VLOOKUP From Another Sheet
vba macro for vlookup from another sheet1

In the previous post, you should know that how to fix or remove the #N/A error when using VLOOKUP formula to lookup value from another sheet. And this post will show you how to use VBA code to vlookup data ...

How To Insert Comments in Protected Worksheet in Excel
insert commetns in protected workshee3

This post will show you how to allow comments in a protected worksheet in Excel. You can easily to insert comments into cells in a normal worksheet in Excel, but if want to insert a comment in a worksheet that ...

How To Convert Text to Upper Cases(Using VBA) in Excel
convert text to upper cases1

This post will show you how to switch from lower case to upper case in Excel. and I am going to show you two different ways of converting text to upper cases using formula or VBA macro in Excel 2013,Excel ...

How To Hide Every Other Row in Excel (Using VBA)
hide every other row1

This post will show you how to hide alternate rows or columns in Excel or how to hide every third, fourth, fifth row or column in Excel. If you want to hide every other row in your current worksheet, how ...

How to Disable the Save As Prompt in Excel
disable save as prompt1

This post will show you how to use a VBA Macro to save an Excel file and overwrite any existing file without a prompt so that you are going to get the little window that says file already exists do ...

How to Count Cells that Contain even or odd numbers in Excel
count cells that contain even numbers5

This post will guide you how to count the number of cells that contain odd or even numbers within a range of cells using a formula in Excel 2013/2016.How do I count cells that contain odd numbers through the use ...

How to Count Cells that Contain negative Numbers in Excel

This post will guide you how to count the number of cells that contain negative numbers within a range of cells using a formula in Excel 2013/2016.You can count the number of negative numbers in your data using easy functions ...

How to Count Cells Are Not Blank or Empty in Excel
count non blank nonempty cells5

This post will guide you how to count cells that are not blank or empty in a given range cells using a formula in Excel 2013/2016.How do I count the number of cells that are not blank in a particular ...

How to Count Cells Less Than a Specific Value in Excel
count cells lessr than5

This post will guide you how to count the number of cells less than a particular numeric value in a given range cells using a formula in Excel 2013/2016. How do I count cells that are less than a specific ...

How to Count Cells Greater Than a Specific Value in Excel
count cells greater than 5

This post will guide you how to count the number of cells greater than a particular numeric value in a given range cells using a formula in Excel 2013/2016. How do I count cells that are greater than a specific ...

Sidebar