+ Reply to Thread
Results 1 to 3 of 3

Conditional concatenation problem for badly organised data

  1. #1
    Registered User
    Join Date
    02-02-2012
    Location
    Cambridge, England
    MS-Off Ver
    Excel 2007
    Posts
    1

    Conditional concatenation problem for badly organised data

    Problem: Clean up of data that I have no control over the source

    See attached workbook

    Source data looks like:
    "Review ID" "Question Text" "Answer Text Line 1a"
    "Blank Cell" "Blank Cell" "Answer Text Line 2a"
    "Blank Cell" "Blank Cell" "Answer Text Line 3a"
    "Review ID" "Question Text" "Answer Text Line 1b"
    "Blank Cell" "Blank Cell" "Answer Text Line 2b"
    "Blank Cell" "Blank Cell" "Answer Text Line 3b"
    "Blank Cell" "Blank Cell" "Answer Text Line 4b"
    "Review ID" "Question Text" "Answer Text Line 1c"
    "Blank Cell" "Blank Cell" "Answer Text Line 2c"

    Result required:
    "Review ID" "Question Text" "Answer Text Line 1a & 2a & 3a"
    "Review ID" "Question Text" "Answer Text Line 1b & 2b & 3b & 4b"
    "Review ID" "Question Text" "Answer Text Line 1c & 2c"

    ie I want to be able to concatenate the arbitrary number of "Answer" lines (let's say minimum of 1 to maximum of 20 lines) for each "Review ID" and "Question Text" neither of which is independently unique, but the AND of the two is unique.

    I'd also be interested to know how to insert a return character in a cell using an equation ie equivalent to alt-return when typing directly in a cell to start a new line.

    My solutions involve using ISTEXT() and CONCATENATE() functions with IF(). However, I'm unable to stop the concatenation to only pickup the required answer lines and not those of the following question.

    Thanks in advance for any hints.

    Cheers, XL4NEthing
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Conditional concatenation problem for badly organised data

    Formula are very bad at concatenating an arbitrary number of rows, unless you're prepared to put up with a very long formula with lots of IF statements in.

    The attached solution uses a formula in column D to concatenate the answer text for each question and then formula in columns E, F & G to put in the review ID, question text and concatenated answers.

    The formula in those final three columns uses the range $A$5:$A$500, and the formula in column G also uses $D$5:$D$500 - in these cases 500 is just a value more than the number of actual used rows, and if you were likely to have more than 500 rows of data you could update all of the ranges to $A$5:$A$5000, or $A$5:$A$50000, or $A$5:$A$500000, or whatever suits your needs.

    Hope this helps.
    Attached Files Attached Files

  3. #3
    Valued Forum Contributor mahju's Avatar
    Join Date
    11-27-2010
    Location
    Pakistan, Faisalabad
    MS-Off Ver
    Excel 2010 plus
    Posts
    730

    Re: Conditional concatenation problem for badly organised data

    Hi

    Check this

    Regard
    Attached Files Attached Files
    Mark the thread as solved if you are satisfied with the answer.


    In your first post under the thread tools.

    Mahju

+ 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