Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, and 2016. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Combining Multiple Rows in a Column.

Combining Multiple Rows in a Column

by Allen Wyatt
(last updated June 24, 2017)

4

Bonnie described a common problem that occurs when importing a file into Excel. The file being imported is a scanned text file, and the import goes just fine, with one small glitch: in one column where there was wrapped text in the original document, the text now occupies several rows in the worksheet. Bonnie is looking for a way to combine those rows back into a single cell in that column.

There are a couple of ways this can be done. If you don't have to do this too often, a formulaic approach may be best. Just use the ampersand (&) to concatenate the contents of the rows you want to combine:

=C6 & " " & C7 & " " & C8 & " " & C9

The result is all the text combined into a single cell. You can copy this result to the Clipboard and use Paste Special to put it into the final cell where you need it. Finally, you can delete the original multiple rows that are no longer needed.

Another approach works very well if the cells you want to combine all contain text. Let's say you want to combine cells C6:C9. All you need to do is to widen column C so it could contain the contents of those cells on a single line. Then, select the cells. Display the Home tab of the ribbon and note that there is a tool in the Editing group called Fill. If you click the tool you see a drop-down list of options from which you should choose Justify. When you do, you end up with all the values in cell C6, separated by spaces.

If you need to concatenate cells quite often, you may benefit from a simple macro:

Sub Combine()
    Dim J As Integer

    If Selection.Cells.Count > 1 Then
        For J = 2 To Selection.Cells.Count
            Selection.Cells(1).Value = _
              Selection.Cells(1).Value & " " & _
              Selection.Cells(J).Value
            Selection.Cells(J).Clear
        Next J
    End If
End Sub

To use this macro, select the cells you want to concatenate and then run the macro. The contents of all the cells are combined into the first cell in the selection, then whatever is in the other cells is cleared. The macro doesn't delete any rows; that is left for you to do. It does, however, combine the contents quickly—even more quickly if you assign a shortcut key to the macro.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (11496) applies to Microsoft Excel 2007, 2010, 2013, and 2016. You can find a version of this tip for the older menu interface of Excel here: Combining Multiple Rows in a Column.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Using the Address Book

Ways to use the address book when printing envelopes and labels.

Discover More

Word Count in Multiple Selections

Getting a word count for an entire document is easy. What you may not know is that some versions of Word can also provide ...

Discover More

Simple Relative References in External Links

Linked data can be essential in pulling information from one workbook to another. One downside of links, however, is that ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (ribbon)

Highlighting the Rows of Selected Cells

If you lose your place on the screen quite often, you might find it helpful to have not just a single cell highlighted, but ...

Discover More

Changing Limited Relative References to Absolute

Do you need to change whether a particular reference in a formula uses a relative or absolute reference? If so, you may ...

Discover More

Deleting Rows before a Cutoff Date

If you are using Excel to work with data that is date-centered, you may want to delete some of the data before a specific ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 3 + 8?

2017-06-30 03:00:23

Stephen

Ah yes, sorry. I tried to do it for columns rather than rows. That doesn't work!


2017-06-29 03:00:52

Shreepad SM Gandhi

Thanks Allen
Wasn't aware that Fill-Justify could also be used this way. Tried it. Nice.
Stephen, 
Even I use Excel 2010. It worked well for me. Am wondering why you couldn't succeed. Suggest to follow just the way explained in this tip. Hope it works.
Andrew, 
I guess Excel 2010 doesn't has this Excel function TEXTJOIN. However I do have Excel 2013 on my another machine. Shall try that for sure. Thanks for sharing.


2017-06-24 08:52:40

Stephen

"Another approach works very well...." This simply does not work for me using Excel 2010.


2017-06-24 05:42:33

Andrew

There is a new function in Excel, TEXTJOIN, available in the latest version of Excel.

Allen's formula above could be replaced with
=TEXTJOIN(" ",TRUE,C6:C9)

The first argument is the delimiter you wish to use, and the second relates to how empty cells are treated.

More detail is at https://support.office.com/en-us/article/TEXTJOIN-function-357b449a-ec91-49d0-80c3-0e8fc845691c.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.