Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

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

How to join multiple rows and columns into a single long row? Maybe, it seems easy for you, because you can copy them one by one and join them into a row manually. But it will be time consuming and tedious if there are hundreds of rows and columns. Here I will talk about some quick tricks to solve it.

Transpose / Convert columns and rows into single row with formula

Transpose / Convert columns and rows into single row with VBA code

Transpose / Convert columns and rows into single row with Kutools for Excel

Office Tab Enable Tabbed Editing and Browsing in Office, and Make Your Work Much Easier...
Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%
  • Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
  • More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words.
  • Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum.
  • Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns.
  • Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Send Personalized Emails to Multiple Recipients in Bulk.
  • Super Filter: Create advanced filter schemes and apply to any sheets; Sort by week, day, frequency and more; Filter by bold, formulas, comment...
  • More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.

arrow blue right bubble Transpose / Convert columns and rows into single row with formula


Supposing you have a range of data as following screenshot shows, you can convert the range data into one row in a new worksheet with a long formula.

doc-convert-range-to-row1

Please apply the formula as this:

1. In a new worksheet of the active workbook, click cell A1, copy and paste this formula: =OFFSET(Sheet1!$A$1,((ROW()-1)*5)+(FLOOR(COLUMN()-1,4)/4),(COLUMN()-1)-(FLOOR(COLUMN()-1,4)))

Note: Sheet1!$A$1 is the worksheet and range references that you want to use.

ROW()-1)*5 in the above formula, 5 stands for the row number; and COLUMN()-1,4)/4, the 4 stands for the column number. You can change them as your need.

2. Then drag the fill handle over to right until number 0 is appeared. In this case, all the data in the range has been transposed into a single row in a new worksheet. See screenshot:

doc-convert-range-to-row2


arrow blue right bubble Transpose / Convert columns and rows into single row with VBA code

The following VBA code also can help you convert a range of data to one row.

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.

Sub TransformOneRow()
'Updateby20131120
Dim InputRng As Range, OutRng As Range
xTitleId = "KutoolsforExcel"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Ranges to be transform :", xTitleId, InputRng.Address, Type:=8)
Set OutRng = Application.InputBox("Paste to (single cell):", xTitleId, Type:=8)
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 + 0)
Next
Application.ScreenUpdating = True
End Sub

3. Then press F5 key to run the code, a dialog is popped out for you to select a range of contents you want to convert into a row, and click Ok, another popped-up dialog is for you to select a single cell to put out the result. See screenshots:

Then Click Ok, the contents in the selected range are converted into a row. See screenshot:

Note: In Set OutRng = OutRng.Offset(0, xCols + 0), you can change 0 to any number to meet your need.

For exampel, if you want to separate the results accroding to the original rows by one column, you can change Set OutRng = OutRng.Offset(0, xCols + 0) to Set OutRng = OutRng.Offset(0, xCols + 1), the results are shown as following:


arrow blue right bubble Transpose / Convert columns and rows into single row with Kutools for Excel

It seems the above two methods are somewhat difficult for us Excel beginner, here I will talk about a handy tool-Kutools for Excel for you.

Kutools for Excel includes more than 300 handy Excel tools. Free to try with no limitation in 30 days. Get it Now

With the utility Transform Range of Kutools for Excel, you can quickly transform a range to a single row, please do as follows:

1. Select the range that you want to transpose.

2. Click Kutools > Range Converter > Transform Range, see screenshot:

doc-convert-range-to-row4

3. In the Transform Range dialog box, select Range to single row option, see screenshot:

doc-convert-range-to-row5

4. Then click OK, and click a cell to put the result from the pop out box.

doc-convert-range-to-row6

5. Click OK, and the data in the range has been transposed into a single row. See screenshots:

doc-convert-range-to-row1
-1
doc-convert-range-to-row7

If you want to know more about this feature, please visit Transform Range.


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?


Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial.
kte tab 201905

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!
officetab bottom
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    KT · 4 months ago
    From:

    A B C
    E F G
    H I J



    To:

    A B C E F G H I J

    How to change from above to single row?
    • To post as a guest, your comment is unpublished.
      Tim · 3 months ago
      Have you been able to accomplish this? I'm having the same problem.
  • To post as a guest, your comment is unpublished.
    Vinay Doddapaneni · 2 years ago
    Hello, i would to know how to convert 10 rows in excel into 10 different pdf's (or) word document in java coding. Thank you
  • To post as a guest, your comment is unpublished.
    bsac · 2 years ago
    Transform range in Kutools did not work. Waste of time. Install de-installed my ASAP utilities WITHOUT permission. Total B.S.
  • To post as a guest, your comment is unpublished.
    prakash · 3 years ago
    i want to convert following word table

    pf 250 basic 3000 da 2000
    wa 100 hra 1500 oa 300

    into
    pf wa basic hra da oa
    250 100 3000 1500 2000 300

    can anyone help me
  • To post as a guest, your comment is unpublished.
    Ashok · 3 years ago
    I need to convert the following type data to a single row as mentioned last;
    -----------------------------------------------------------------------------------------------------------------------------------------------------------
    A B C D E F G H
    -----------------------------------------------------------------------------------------------------------------------------------------------------------
    Sl.No. - Mem.No. - Name & Address - Parents Name - Qualification - Occupation - Present Address - Remarks
    -----------------------------------------------------------------------------------------------------------------------------------------------------------
    1 103 Rajesh Govind BA Welder Rajesh G X
    KayGee Villa Dubai AN Apartments
    Kastur Marg RN Street
    Coimbatore Bangaluru
    Tamil Nadu Karnataka

    2 104 Ganesh

    1 - 103 - Rajesh - KayGee Villa - Kastur Marg - Coimbatore - Tamil Nadu - Govind - - - - BA - - - - Welder - Dubai - - - - Rajesh G - AN Apartments - RN Street - Bangaluru - Karnataka - X
    2 - 104 - Ganesh - ................................................
  • To post as a guest, your comment is unpublished.
    Brian · 4 years ago
    I tried the above formula:

    =OFFSET(Sheet1!$A$1,((ROW()-1)*5)+(FLOOR(COLUMN()-1,4)/4),(COLUMN()-1)-(FLOOR(COLUMN()-1,4)))

    but all it does is place the value from sheet1 A1 in all of the columns. Why won't it display the other data?

    Example:
    1 2 3 4
    5 6 7 8
    9 1 2 3

    Becomes this after adding your formula:
    1 1 1 1 1 1 1 1 1 1 1 1
  • To post as a guest, your comment is unpublished.
    ibnu marjan · 5 years ago
    ABC TRAVELS
    KING'S ST. KANDY
    081-9999999

    DEF TRAVELS
    KING'S ST. KANDY
    081-8888888
    --
    -- about 500 travels like in same row as above, and there is blank row in between each travel data. I would like to have this as following in easy way.
    column A Column B Column C

    ABC TRAVELS KING'S ST. KANDY 081-9999999
    DEF TRAVELS KING'S ST. KANDY 081-8888888
    ---
    Please help
  • To post as a guest, your comment is unpublished.
    Frank · 5 years ago
    I have a fix range in sheet1 like (D8:F14). How to transpose it to sheet2 fixed row like (C3:W3)?
    Thanks for your response.
  • To post as a guest, your comment is unpublished.
    Hien Tran · 5 years ago
    Could you please help me to transpose / convert single row (wrap text) into rows?

    Thanks in advance!!!