+ Reply to Thread
Results 1 to 9 of 9

Concatenate multiple columns by row and insert semi colons and spaces

  1. #1
    Registered User
    Join Date
    08-31-2012
    Location
    Los Angeles, CA. USA
    MS-Off Ver
    Excel 2004
    Posts
    5

    Concatenate multiple columns by row and insert semi colons and spaces

    Hi folks,
    I am a newbie here in the Excel Forum but not completely new to Excel. I have a challenge with concatenating multiple columns and inserting semicolons and spaces.

    The top of my sheet has fields to enter date, product, style etc. These I have been able to concatenate into a string with no problem. Part way down the page I have a couple of columns that the user needs to enter product sku numbers and descriptions. The rows are broken down into about 20 sections and not all rows will contain a sku and description. This will create empty rows in my 2 columns.

    I have a row at the bottom of the screen where the concatenated string of data is displayed (it's used as metadata for images).

    The challenge is to start at the top of the 2 columns and concatenate the contents until it reaches the last row in the product info section. Between the contents of each row I need to place "; " semi colon and a space. The empty rows need to be ignored.

    Ahh, just realized I can add a file so I hope it helps see what I am trying to do.
    Metadata sheet-updated.xls

    The end result I am hoping for...
    092812-transitional-mirror; transitional; living room; mirror scene; 12345 crystal chandelier; 54321 brass floor lamp; T4321 recliner; T4322 ottoman; 01234 area rug; W1234 round mirror; 98765 crystal candlesticks

    Many thanks,
    Limey

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Concatenate multiple columns by row and insert semi colons and spaces

    F3: =A3&";"&B3&";"&C3&";"&D3&";"

    F7: =F3 & IF(C7="", "", C7&";"&D7)

    F8: =F7 & IF(C8="", "", ";"&C8&";"&D8)

    Copy F8 down. The last cell has your metadata. Hide this column if you wish and set a reference to =F46 in A47.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    08-31-2012
    Location
    Los Angeles, CA. USA
    MS-Off Ver
    Excel 2004
    Posts
    5

    Re: Concatenate multiple columns by row and insert semi colons and spaces

    Thank you Jerry! Much appreciated. I'll give it a whirl.

    Limey
    Last edited by limey; 08-31-2012 at 11:26 PM.

  4. #4
    Registered User
    Join Date
    08-31-2012
    Location
    Los Angeles, CA. USA
    MS-Off Ver
    Excel 2004
    Posts
    5

    Re: Concatenate multiple columns by row and insert semi colons and spaces

    Hi Jerry,
    The first part worked for F3 but the lines for F7 and F8 at first gave #Value and then when clicked changed to #N/A
    =F3 & IF(C7="", "", C7&";"&D7)
    =F7 & IF(C8="", "", ";"&C8&";"&D8)

    Any suggestions? Do I need Excel 2010 for this to work?

    Limey

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Concatenate multiple columns by row and insert semi colons and spaces

    CLick on one of those cells and use the Evaluate Formula icon to watch it unfold.

    Here's your file back.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    08-31-2012
    Location
    Los Angeles, CA. USA
    MS-Off Ver
    Excel 2004
    Posts
    5

    Re: Concatenate multiple columns by row and insert semi colons and spaces

    Many thanks Jerry! I got it looking really pretty now and hidden column F with all the workings as you suggested. I placed a row at the top that contains the end result (the metadata string).
    This is going to be a valuable tool for us and save a lot of headaches!

    All the best,
    Limey (Paul)

  7. #7
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Concatenate multiple columns by row and insert semi colons and spaces

    @ limey

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  8. #8
    Registered User
    Join Date
    08-31-2012
    Location
    Los Angeles, CA. USA
    MS-Off Ver
    Excel 2004
    Posts
    5

    Re: Concatenate multiple columns by row and insert semi colons and spaces

    Thank you Cutter! I'm sorry I didn't mark the thread as solved. As you can see by the time I posted the reply to Jerry it was almost 2am in the morning and I overlooked it the protocol. I would certainly like to add to Jerry's reputation level but I don't see that I have that option any longer. Is it too late?

    Jerry, again, thank you!!

    Limey (Paul)

  9. #9
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Concatenate multiple columns by row and insert semi colons and spaces

    Right here under people's names:

    http://screencast.com/t/la6y4djydTj

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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