+ Reply to Thread
Results 1 to 7 of 7

Concatenate cells with delimiter, new row for values after blank cells

  1. #1
    Registered User
    Join Date
    11-28-2011
    Location
    Manchester, England
    MS-Off Ver
    Excel 2010
    Posts
    3

    Concatenate cells with delimiter, new row for values after blank cells

    Hi,

    Have got a CSV file of religious verse, with each verse in a new row, verses separated by a blank cell:

    Verse 1
    abcdef
    abcdefg
    abcdefgh

    Verse 2
    abcdef
    abdefg
    abcdefgh

    I need to import it into a database for use by an Android app, but the CSV has to be in the format of:

    Tag Value
    1 a,b,c
    2 d,e,f

    and so on.

    Is it possible for a concatenate VBA function that will concatenate the rows, using a comma delimiter, but when a blank cell is encountered, to create concatenate the subsequent cells into a new row, so that it looks as per the Tag/Value combination above please?

    I've looked at a few Concatenate VBA functions on here but haven't got figured out how to do it yet beyond manual range selection!

    Thanks in advance!

  2. #2
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Concatenate cells with delimiter, new row for values after blank cells

    It would be easier to help you if you uploaded a dummy workbook, containing data in the same structure.
    With a sheet of the desired outcome.

    Steffen
    Please take time to read the forum rules

  3. #3
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Concatenate cells with delimiter, new row for values after blank cells

    Use Text To Columns, Fixed Width option.

  4. #4
    Registered User
    Join Date
    11-28-2011
    Location
    Manchester, England
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Concatenate cells with delimiter, new row for values after blank cells

    Ok sample csv file posted. The left is the text, the right is an example of how ideally it would be set out. Any assistance much appreciated! Thanks.
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Concatenate cells with delimiter, new row for values after blank cells

    Hi,

    Try this code

    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Concatenate cells with delimiter, new row for values after blank cells

    Take a look at the file
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    11-28-2011
    Location
    Manchester, England
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Concatenate cells with delimiter, new row for values after blank cells

    Thanks Steffen, that worked perfectly!

    JieJenn, thank you also for your efforts. Unfortunately it didn't contain a delimiter, which is crucial for Google App Engine to process the content properly.

    Thanks very much indeed both! Now I'm going to go through the code and work out how you did it!

+ 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