Skip to main content

How to transpose every 5 or n rows from one column to multiple columns?

Author: Xiaoyang Last Modified: 2025-04-18
transpose every 5 or n rows

Transposing every 5 or n rows from a single column into multiple columns in Excel can be very useful when reorganizing data for analysis or reporting. Supposing, you have long data in column A, and now, you want to transpose every 5 rows from column A to multiple columns, such as transpose A1:A5 to C6:G6, A6:A10 to C7:G7, and so on as left screenshot shown. This task can be approached using different methods, each with its own advantages. Let's go through a detailed step-by-step guide on how to accomplish this

Transpose every 5 or n rows from one column to multiple columns


 Transpose every 5 or n rows from one column to multiple columns with formula

In Excel, you can apply the following formula to transpose every n rows from one column to multiple columns, please do as follows:

1. Enter the following formula into a blank cell where you want to put the result.

=INDEX($A:$A,ROW(A1)*5-5+COLUMN(A1))
Note: In the above formula, "A:A" is the column reference that you want to transpose, and "A1" is the first cell of the used column, the number "5" indicates the number of columns that your data will locate, you can change them to your need. And the first cell of the list must be located at the first row in the worksheet.

2. Then drag the fill handle right to five cells, and go on dragging the fill handle down to the range of cells until displays 0 , see screenshot:

drag the fill handle right to cells, and go on dragging the fill handle down to the range of cells until displays 0

 Transpose every 5 or n rows from one column to multiple columns with Kutools for Excel

Are you frustrated with transposing Excel data from one column to multiple columns? "Kutools for Excel"'s "Transform Range" feature is here to solve your problems! Whether you need to transpose every 5 rows or a custom number of rows, we've got you covered. Flexible row conversion allows you to freely choose the number of rows to transpose from one column to multiple columns. It's simple and quick, requiring no complex operations—just a few clicks to get it done.

Kutools for Excel offers over 300 advanced features to streamline complex tasks, boosting creativity and efficiency. Itegarate with AI capabilities, Kutools automates tasks with precision, making data management effortless. Detailed information of Kutools for Excel...         Free trial...

After installing "Kutools for Excel", please do as follows:

1. Select the data in the column, and then click "Kutools" > "Range" > "Transform Range", see screenshot:

2. In the "Transform Range" dialog box, select "Single column to range" option under the "Transform type", and then check "Fixed value" under the "Rows per record", then specify the number of columns that you want to transpose to in the "Fixed value" box, see screenshot:

specify the options in the dialog box

3. And then click "Ok" button, in the popped out box, please select a cell to output the result, see screenshot:

select a cell to output the result

4. Then click "OK" button, and your column data has been transposed every 5 rows as following screenshot shown:

column data is transposed every 5 rows

 Transpose every 5 or n rows from one column to multiple columns with VBA code

If you can't apply the formula correctly, the following VBA code also can help you.

1. Hold down the "ALT" + "F11" keys to open the "Microsoft Visual Basic for Applications" window.

2. Click "Insert" > "Module", and paste the following code in the "Module" Window.

VBA code: Transpose every 5 or n rows from one column to multiple columns:

Public Sub TransposeData()
'updateby Extendoffice
    Dim xLRow As Long
    Dim xNRow As Long
    Dim i As Long
    Dim xUpdate As Boolean
    Dim xRg As Range
    Dim xOutRg As Range
    Dim xTxt As String
    On Error Resume Next
    xTxt = ActiveWindow.RangeSelection.Address
    Set xRg = Application.InputBox("Please select data range(only one column):", "Kutools for Excel", xTxt, , , , , 8)
    Set xRg = Application.Intersect(xRg, xRg.Worksheet.UsedRange)
    If xRg Is Nothing Then Exit Sub
    If (xRg.Columns.Count > 1) Or _
       (xRg.Areas.Count > 1) Then
        MsgBox "the used range only contain one column", , "Kutools for Excel"
        Exit Sub
    End If
    Set xOutRg = Application.InputBox("please select output range(specify one cell):", "Kutools for Excel", xTxt, , , , , 8)
    If xOutRg Is Nothing Then Exit Sub
    Set xOutRg = xOutRg.Range(1)
    xUpdate = Application.ScreenUpdating
    Application.ScreenUpdating = False
    xLRow = xRg.Rows.Count
    For i = 1 To xLRow Step 5
        xRg.Cells(i).Resize(5).Copy
        xOutRg.Offset(xNRow, 0).PasteSpecial Paste:=xlPasteAll, Transpose:=True
        xNRow = xNRow + 1
    Next
    Application.ScreenUpdating = xUpdate
End Sub

3. After pasting the code, please press "F5" key to run it, and a prompt box will pop out to remind you select the column that you want to transpose, see screenshot:

vba code to select the data range

4. Then click "OK", and select one cell where you want to put the result in another popped out box, see screenshot:

vba code to select one cell to put the result

5. And click "OK", the data in the column has been converted to five columns that you need, see screenshot:

the data in the column is converted to five columns
Note: In the above code, you can change the number "5" to other number you need.

To transpose every 5 or n rows from one column to multiple columns in Excel, this article introduces three effective methods. Each of these methods offers a different approach to rearranging data in Excel, catering to varying levels of user familiarity with Excel tools and programming. If you're interested in exploring more Excel tips and tricks, our website offers thousands of tutorials.

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions…
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!