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

How to convert multiple rows and columns into a single row in Excel?

AuthorXiaoyangLast modified

Combining a range containing multiple rows and columns into one long row manually can be time-consuming, especially with a large dataset. This article explains three ways to convert the range quickly: an Excel formula, VBA, and Kutools for Excel.

MethodBest forKey consideration
FormulaCreating a result that remains linked to the source valuesRequires entering and filling a formula across the row
VBAAutomating a one-time conversionRequires a macro-enabled environment
Kutools for ExcelConverting a selected range without formulas or codeCreates the single-row result in a selected location

Convert multiple rows and columns into a single row with a formula

Suppose your source data is in Sheet1!A1:D5, as shown below. The following formula returns the values row by row in a single horizontal row.

A range containing multiple rows and columns in Excel
  1. In a new worksheet in the same workbook, select cell A1 and enter this formula:

    =IFERROR(INDEX(Sheet1!$A$1:$D$5,1+INT((COLUMN(A1)-1)/COLUMNS(Sheet1!$A$1:$D$5)),MOD(COLUMN(A1)-1,COLUMNS(Sheet1!$A$1:$D$5))+1),"")

  2. Drag the fill handle to the right until all values from the source range appear in one row.
    A multi-row range converted into a single row with a formula

📝 Note:

Sheet1!$A$1:$D$5 is the source range. Replace it with the worksheet name and range containing your data. The formula reads the source range from left to right, one row at a time.


Convert multiple rows and columns into a single row with VBA

The following VBA code copies each row in the selected range and places the rows side by side.

  1. Press Alt + F11 to open the Microsoft Visual Basic for Applications window.
  2. Click Insert > Module, and paste the following code into the Module window.
    Sub TransformOneRow()
        Dim InputRng As Range
        Dim OutRng As Range
        Dim xTitleId As String
        Dim xRows As Long
        Dim xCols As Long
        Dim i As Long
    
        xTitleId = "KutoolsforExcel"
        On Error Resume Next
        Set InputRng = Application.InputBox("Select the range to transform:", xTitleId, Selection.Address, Type:=8)
        If InputRng Is Nothing Then Exit Sub
        Set OutRng = Application.InputBox("Select the first destination cell:", xTitleId, Type:=8)
        If OutRng Is Nothing Then Exit Sub
        On Error GoTo 0
    
        Application.ScreenUpdating = False
        xRows = InputRng.Rows.Count
        xCols = InputRng.Columns.Count
    
        For i = 1 To xRows
            InputRng.Rows(i).Copy OutRng
            Set OutRng = OutRng.Offset(0, xCols)
        Next i
    
        Application.CutCopyMode = False
        Application.ScreenUpdating = True
    End Sub
  3. Press F5 to run the code. Select the source range in the first dialog box, click OK, and then select the first destination cell in the second dialog box.
    VBA dialog box for selecting the source range >>> VBA dialog box for selecting the destination cell
  4. Click OK. The contents of the selected range are converted into a single row.
    Original range before conversion with VBA >>> Range converted into a single row with VBA

📝 Note:

To leave one blank column between the values taken from each original row, change Set OutRng = OutRng.Offset(0, xCols) to Set OutRng = OutRng.Offset(0, xCols + 1).

Single-row VBA result with spaces between the original rows

Convert multiple rows and columns into a single row with Kutools for Excel

The formula requires adjusting a range reference, while VBA requires running code. Kutools for Excel's Transform Range feature converts the selected range into a single row without formulas or macros.

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...
  1. Select the range you want to convert.
  2. Click Kutools > Range > Transform Range.
  3. In the Transform Range dialog box, select Range to single row.
    Range to single row selected in the Transform Range dialog box
  4. Click OK, and select the first cell where you want to place the result.
    Dialog box for selecting the destination of the single-row result
  5. Click OK. The selected range is converted into a single row.
    Original multi-row and multi-column range >>> Selected range converted into a single row with Kutools for Excel

Learn more about the Transform Range feature.

Download Kutools for Excel – Free 30-day trial


Frequently asked questions

In what order are the cells placed in the single row?

All three methods process the source range row by row, from left to right. After the values in the first source row, they continue with the first value in the next row.

Will the result update when the source data changes?

The formula result updates when the source values change. The VBA and Kutools methods create static results that do not update automatically.

Why is Kutools not showing in my Excel?

Kutools may not be installed, enabled, or loaded correctly. Make sure it is installed, then go to File > Options > Add-ins to check whether Kutools is disabled. If it is installed and enabled but still does not appear, restart Excel or reinstall Kutools.


Related articles

How to change row to column in Excel?

How to transpose / convert a single column to multiple columns in Excel?

How to transpose / convert columns and rows into single column?

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