+ Reply to Thread
Results 1 to 6 of 6

Concatenation Function

  1. #1
    Registered User
    Join Date
    03-18-2011
    Location
    Jonesboro, AR
    MS-Off Ver
    Excel 2010
    Posts
    13

    Concatenation Function

    I have data in columns A2 through BK2 and I want to concatenate these into one cell. My problem is I need a comma and space between each concatenated item.

    Example: If I have John in A2, William in B2 and Doe in C2 I want to concatenate them but....

    instead of looking like this:

    JohnWilliamDoe

    It would look like this:

    John, William, Doe

    Is there a simple way to do this other than make a new column full of spaces and a new column full of commas and concatenating those between each cell? The way I have it setup I have placed the columns of spaces and texts but I am going to have to do =CONCATENATE(A2,BM2,BN2,B2,BM2,BN2,C2........all the way through BK2. Surely there is a simpler way or am I stuck?
    Last edited by Jakz34; 03-18-2011 at 01:14 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Concatenation Function

    You can include the comma and space in your concatenation formula

    e.g. =A2&", ",B2&", "&C2&", ", etc...

    but that would be quite long if you need to concatenate everything from column A to Bk

    You can use a UDF.

    So if you paste this code in your VB editor (Alt+F11, Insert|Module)

    Please Login or Register  to view this content.
    then use formula:

    =aconcat(A2:BK2,", ")

    that should get you quicker results.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    03-18-2011
    Location
    Jonesboro, AR
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Concatenation Function

    If I used the above, could I still copy the concatenation function all the way down the column for data in the other rows on the spreadsheet?

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Concatenation Function

    In both cases, yes you could.

  5. #5
    Registered User
    Join Date
    03-18-2011
    Location
    Jonesboro, AR
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Concatenation Function

    Wow, that worked perfectly. Now I have one minor issue. Not every row contains data within each cell, some may go to column BK other may end at M or before or after, it is really various. Is there anyway to remove the extra comma and spaces where they are not needed?

    Thanks so much for your assistance. It is greatly appreciated.

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Concatenation Function

    Yes, use this formula with the UDF above:

    =SUBSTITUTE(TRIM(aconcat(IF(A2:BK2<>"",A2:BK2,"")," "))," ",", ")

    Confirm this formula with CTRL+SHIFT+ENTER keys and you will see { } brackets appear around the formula, then copy down.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1