KutoolsforOffice — One Suite. Five Tools. Get More Done.

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

AuthorXiaoyangLast modified

Transposing every 5 or n rows from a single column into multiple columns can make long lists easier to analyze or report. For example, you may want to transpose A1:A5 to C6:G6, A6:A10 to C7:G7, and so on, as shown in the screenshot.

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

Excel offers several ways to complete this task, depending on whether you prefer a formula, a dedicated tool, or VBA code.

MethodBest forSetupChanging the number of rows
FormulaUsers comfortable working with formulasEnter a formula, then fill it across and downEdit the number in the formula and adjust the filled range
Kutools for ExcelUsers who want a quick, code-free solutionSelect the data and specify the rows per recordEnter the required number directly in the dialog box
VBAUsers familiar with macros who need an automated solutionInsert and run VBA codeChange the number in the code before running it

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

In Excel, you can use the following formula to transpose every n rows from one column into multiple columns:

  1. Enter the following formula in the first blank cell where you want to display the result:
    =INDEX($A:$A,ROW(A1)*5-5+COLUMN(A1))
    Enter a formula to transpose every five rows

    📝 Note:

    In this formula, A:A is the column you want to transpose, A1 represents the first row of the source list, and 5 is the number of items to place in each output row. Change these references and values as needed. This formula assumes that the source list begins in the first row of the worksheet.

  2. Drag the fill handle five cells to the right. Then continue dragging the filled range down until the remaining cells display 0.
    Fill the formula across five columns and then down

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

With the Transform Range feature in Kutools for Excel, you can convert every 5 rows—or any number of rows—from a single column into multiple columns without creating a formula or editing VBA code. Simply specify how many source rows should be placed in each output row.

Kutools for Excel offers over 300 advanced features to streamline complex tasks, boosting creativity and efficiency. Integrated 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, follow these steps:

  1. Select the data in the column, and then click Kutools > Range > Transform Range.
    Open Transform Range from the Kutools Range menu
  2. In the Transform Range dialog box:
    • Select Single column to range under Transform type.
    • Select Fixed value under Rows per record.
    • Enter the number of items you want to place in each output row.
    Specify the transform type and rows per record
  3. Click OK. In the dialog box that appears, select the first cell of the output range.
    Select the first cell of the output range
  4. Click OK. The data from the column is transposed into rows containing five items each.
    Column data transposed into rows of five items

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

If you prefer an automated method and are comfortable working with macros, the following VBA code can also transpose every five rows from one column into multiple columns.

  1. Press Alt + F11 to open the Microsoft Visual Basic for Applications window.
  2. Click Insert > Module, and then paste the following code into 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. Press F5 to run the code. In the first dialog box, select the column you want to transpose.
    Select the source column in the VBA dialog box
  4. Click OK, and then select the first cell where you want to place the result.
    Select the output cell in the VBA dialog box
  5. Click OK. The data in the selected column is converted into rows containing five items each.
    Column data converted into rows of five items with VBA

📝 Note:

To use a different number of items per output row, replace both instances of 5 in the following lines with the required number:

For i = 1 To xLRow Step 5
xRg.Cells(i).Resize(5).Copy

This article introduces three ways to transpose every 5 or n rows from one column into multiple columns. A formula works well for users familiar with Excel functions, while VBA can automate the process through code. For a simpler option, Kutools for Excel lets you specify the number of rows directly and complete the transformation without formulas or programming. For more Excel tips and tricks, visit our collection of Excel tutorials.


Frequently Asked Questions

How can I transpose a number of rows other than five?

In the formula, replace both instances of 5 with the required number. In Kutools for Excel, enter the number in the Fixed value box. In the VBA code, change both instances of 5 in the loop and Resize statements.

Why does the formula return 0 in some cells?

The formula may return 0 after it reaches the end of the source list or when the referenced source cell is blank. You can stop filling the formula down once all source data has been transposed.

Can the source list begin below row 1?

Yes, but the formula shown in this article must be adjusted because it assumes the source list begins in row 1. Kutools for Excel and the VBA method allow you to select the actual source range directly.

What happens if the total number of items is not evenly divisible by five?

The final output row will contain the remaining items. Any unused positions in that row will remain blank or may display 0 when using the formula, depending on the referenced cells.

Will the transposed results update if the source data changes?

The formula results update automatically when the source data changes. Results created with Kutools for Excel or VBA are static, so you need to run the transformation again to reflect later changes.

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 Toolsets:  12 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
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

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!

All Kutools add-ins. One installer

Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.

ExcelWordOutlookTabsPowerPoint
  • All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
  • One installer, one license — set up in minutes (MSI-ready)
  • Works better together — streamlined productivity across Office apps
  • 30-day full-featured trial — no registration, no credit card
  • Best value — save vs buying individual add-in