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 Columns.

Combining Columns

by Allen Wyatt
(last updated March 9, 2020)


There may be times when you have a need to concatenate cells together. For instance, you may have information in three columns, but you want it combined together into the first column of each row. The following macro, StuffTogether, will do just that. It examines the range of cells you select, and then moves everything from each cell in a row into the first cell of the row.

Sub StuffTogether()
    Dim FirstCol As Integer, FirstRow As Integer
    Dim ColCount As Integer, RowCount As Integer
    Dim ThisCol As Integer, ThisRow As Integer
    Dim J As Integer, K As Integer
    Dim MyText As String

    FirstCol = ActiveWindow.RangeSelection.Column
    FirstRow = ActiveWindow.RangeSelection.Row
    ColCount = ActiveWindow.Selection.Columns.Count
    RowCount = ActiveWindow.Selection.Rows.Count

    For J = 1 To RowCount
        ThisRow = FirstRow + J - 1
        MyText = ""
        For K = 1 To ColCount
            ThisCol = FirstCol + K - 1
            MyText = MyText & Cells(ThisRow, ThisCol).Text & " "
            Cells(ThisRow, ThisCol).Value = ""
        Next K
        MyText = Trim(MyText)
        Cells(ThisRow, FirstCol).Value = MyText
    Next J
End Sub


If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (11944) 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 Columns.

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. ...


Protecting Formulas in Control-Linked Cells

Form controls can be a great way to get information into a worksheet. They are designed to be linked to a cell so that ...

Discover More

Determining the Template Attached to a Document

If you've opened a document in Word, that document has a template attached to it. This tip looks at what those templates ...

Discover More

Assigning Macros to Graphics

The graphics you place in a worksheet can do more than just look pretty. You can also assign macros to a graphic, which ...

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)

Using AutoComplete with Disjointed Lists

AutoComplete can help you to more quickly enter information in a worksheet. How it works, behind the scenes, can affect ...

Discover More

Adding Spaces in Front of Capital Letters

Got some text that is "run together" and needs spaces inserted to improve readability? There are a variety of approaches ...

Discover More

Copying a Cell without Formatting

When you are copying a cell from one place to another (perhaps even to a different worksheet), you may not want to copy ...

Discover More

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

View most recent newsletter.


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}] (all 7 characters, in the sequence shown) 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 seven more than 4?

2020-03-10 15:44:24


@Gerhard Schweizer could not agree more. The formula for combining A1, B1 and C1 with a dash between each would be
All three now appear and other things can be added as well instead of a dash. I have a lot of titles for sections that pull dates and text to form a descriptive heading. I have not have much use for Concatenate once I learned the & method.

2020-03-09 18:12:18


My hat is off to you Willie. Finally, an expert has taken the time to explain the procedure so even the newest Excel user can apprehend. I must admit, I follow the Tips article mostly to catch you and Rick give the best solutions. Thank you.

2016-05-19 07:55:51

Willy Vanhaelen

@Ray J

You have a point. My solution is rather "high-tech VBA" and not simple in the sense of easy to understand. it's working is probably not obvious for novices. I give hereafter a full explanation of how it works, so more experienced users can perhaps learn something.

But even if you stick with the row by row and then cell by cell solution used in this tip's macro, you can drastically simplify it:

Sub StuffTogether()
Dim cell As Range, Ro As Range, S As String
For Each Ro In Selection.Rows
S = ""
For Each cell In Ro.Cells
S = S & cell.Value & " "
Next cell
Ro.Cells(1) = Trim(S)
Next Ro
End Sub

If you read this code, it is almost self explanatory even for novices.

This was also my first approach but then my intuition told me that VBA's Join function was ideal for joining (concatenate) the cells of each row in one go (see the macro in my post of 15 May).

VBA's help says: JOIN returns a string created by joining a number of substrings contained in an array.
Syntax: Join(sourcearray[, delimiter]). If you omit the delimiter Join uses a space by default.
Join expects a 2D array as argument. The cells of a row however are a 3D array but Excel's Index method translates it to a 2D array as expected by Join.

2016-05-16 18:49:37

John Jacobson

I agree with Dean, a User-Defined Function works best for me. I've had my own version for years, almost identical to Dean's below. Advantages:
1. can use any string as a delimiter
2. doesn't destroy the original values
3. doesn't add delimiter for blank cells in the range
4. can use non-contiguous cells. Using Dean's UDF below (with "-" as a delimiter), this would look like =ConcatAll((A2, C2, G2),"-") where a contiguous cell range would look like =ConcatAll(A2:D2,"-").

2016-05-16 08:37:27

Ray J

Fewer lines of code, Willy, but not necessarily simpler (nor intuitive) for the novices that might visit this page.

2016-05-15 12:41:29

Willy Vanhaelen

Simplicity is the ultimate sophistication (Leonardo da Vinci). This tiny macro does the job of the jumbo one in this tip equally well and faster of course:

Sub StuffTogether()
Dim Ro As Range, S As String
For Each Ro In Selection.Rows
S = Join(Application.Index(Ro.Value, 1, 0))
Ro.Cells(1) = S
Next Ro
End Sub

The kernel of this macro is the combination of VBA's Join function and the array version of Excel's Index method. This one line code does the same work as the 9 lines of the For Next J loop in this tip's macro.

2016-05-14 12:58:30


When you work with a program you assume everyone understands the Language/procedure as laid out but we all don't I would recommend that you use screen shots with the descriptions for novices like me, Thanks Bill

2016-05-14 12:54:28

Dean Cardno

I found it easier to do with a UDF. If I need to make it permanent I just paste the results onto themselves as values. The stSep argument allows me to specify a separator - semi-colons for e-mail addresses for example. If I don't need one I just use a space

Function ConcatAll(rgVals as Range, stSep as String) as String

Dim cl as Range

For Each cl in rgVals
If cl.Value <> "" Then
ConcatAll = ConcatAll & cl.Value & stSep
End If
Next cl

ConcatAll = Left(ConcatAll, Len(ConcatAll) - Len(stSep))

End Function

2016-05-14 08:06:07

Gerhard Schweizer

I have always asked myself why Microsoft does not offer an improved version of function CONCATENATE. This function allows just single cells now, and it is rather obsolete since ampersands (&) do the same job. In the improved version, it should be possible to enter one or more arrays (ranges), along with an optional parameter = separator to appear between each element. The new version would even be downward compatible with the old one.

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

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.