+ Reply to Thread
Results 1 to 2 of 2

Possible concatenate/cell combine error

  1. #1
    Registered User
    Join Date
    02-09-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    3

    Possible concatenate/cell combine error

    I have a spreadsheet consisting of sequence numbers (column E), line numbers (column F) and text (Column G).

    For example in E2:E4 i would have sequence no. 9876543 repeated. In F2 there is 1, F3 is 2, F4 is 3. Then in column G i have text – G2 - 'The cat', G3 - 'sat on', G4 - 'the mat'.

    There are several sequence numbers so following on the spreadsheet would have sequence no. 1254567 repeated in cells E5:E8. In F5 - '1', F6 - '2', F7 - '3' and F8 – '4'. Then more text in column G, G5 – 'Romeo Romeo', G6 – 'where for', G7 – 'art', G8 – 'thou Romeo'.

    What I need to do is combine the text cells in column H for each sequence where the line number = 1. So, H2 would read 'The cat sat on the mat' and H5 would read 'Romeo Romeo where for out thou Romeo'.

    The line numbers are not limited so can can go up to 100+ lines in some cases.

    There may be a more simple way of doing this but I basically need to combine the text cells for each sequence number then I can use a VLOOKUP of the combined text to the sequence number in a separate report.

    Thanks in advanced.
    Attached Files Attached Files

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

    Re: Possible concatenate/cell combine error

    If you add this code to a VBA module in the workbook:

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

    =IF(F2=1,TRIM(aconcat(IF($E$2:$E$8=E2,$G$2:$G$8,"")," ")),"")

    confirmed with CTRL+SHIFT+ENTER and not just ENTER and copied down.
    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.

+ 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