Download Practice Workbook
Method 1 – Apply INDEX Function to Transpose Every n Rows to Columns in Excel
Step 1:
- Select a cell. We will select cell F5.
- Enter the following formula in the selected cell.
=INDEX($B:$B,ROW(B5)*4-4+COLUMN(B5))
- Press ENTER and you will get David as the output of the INDEX function in cell F5.
Step 2:
- AutoFill the INDEX function to the rest of the cell of column F.
- AutoFill the INDEX function to the columns G, H and I to get the output as shown in the image below.
Read More: How to Transpose Rows to Columns Based on Criteria in Excel (2 Ways)
Similar Readings
- How to Transpose Duplicate Rows to Columns in Excel (4 Ways)
- Excel Power Query: Transpose Rows to Columns (Step-by-Step Guide)
- How to Transpose Rows to Columns Using Excel VBA (4 Ideal Examples)
- Transpose Multiple Columns into One Column in Excel (3 Handy Methods)
Method 2 – Run a VBA Code to Transpose Every n Rows to Columns in Excel
Step 1:
- Open a Module. From your Developer tab, go to,
Developer → Visual Basic
- A window named Microsoft Visual Basic for Applications – Transpose Rows to Columns will appear. Insert a module for applying our VBA code. Go to,
Insert → Module
Step 2:
- The Transpose Rows to Columns module will appear. Enter the following VBA,
Sub Transpose_Rows_to_Columns()
Dim x As Long
Dim y As Long
Dim z As Long
Application.ScreenUpdating = False
z = Cells(1, Columns.Count).End(xlToLeft).Column
For y = 1 To z Step 2
x = x + 1
Cells(1, y).Copy Destination:=Cells(x, 1)
x = x + 1
Cells(1, y + 1).Copy Destination:=Cells(x, 1)
Next y
Cells(1, 2).Resize(1, z - 1).Clear
Application.ScreenUpdating = True
End Sub
- Run the VBA,
Run → Run Sub/UserForm
- You will be able to transpose every four rows to columns.
Read More: VBA to Transpose Multiple Columns into Rows in Excel (2 Methods)
Things to Remember
You can open Microsoft Visual Basic for Applications window by pressing Alt + F11.
If the Developer tab is not visible in your ribbon, you can make it visible. To do that, go to,
File → Option → Customize Ribbon
Related Articles
- How to Reverse Transpose in Excel (3 Simple Methods)
- How to Transpose Columns to Rows In Excel (6 Methods)
- Convert Columns to Rows in Excel Using Power Query
- How to Convert Columns to Rows in Excel Based On Cell Value
- Conditional Transpose in Excel (2 Examples)
- How to Convert Column to Comma Separated List With Single Quotes
- How to Transpose in Excel VBA (3 Methods)
Get FREE Advanced Excel Exercises with Solutions!