Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Combining Multiple Rows in a Column.
by Allen Wyatt
(last updated January 28, 2017)
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 then 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.
If you need to perform this type of concatenation more than a few times, a simple macro may help:
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 (2417) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Combining Multiple Rows in a Column.
Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!
When you copy a worksheet and then need to make changes to information in that worksheet (such as changing month names), the ...Discover More
If you copy a cell that contains a reference to external data, do you get an error? It could be due to the complexity of the ...Discover More
When editing worksheets, it is important to know how to add rows and columns. Excel provides a couple of quick ways you can ...Discover More
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.