+ Reply to Thread
Results 1 to 6 of 6

Tricky Excel Code

  1. #1
    Registered User
    Join Date
    06-14-2007
    Posts
    3

    Tricky Excel Code

    This is a basic sample of what I have in Colums A and B:

    123 a
    123 b
    654 d
    654 a
    654 r
    789 b
    789 q
    963 s

    This is the format I would want two news columns in:

    123 a,b
    654 d,a,r
    789 b,q
    963 s

    Basically I am trying to merge all the identical A cells while combining the adjacent data into a single, new cell. There are thousands of these, but this is the basic idea.

    Any thoughts. Thanks.

  2. #2
    Forum Contributor harrywaldron's Avatar
    Join Date
    05-24-2007
    Location
    Roanoke, VA
    MS-Off Ver
    Office Professional 2010 BETA
    Posts
    169
    While I'm not sure how to do this in a single cell, the PIVOT function allows the capability of producing a summary matrix where you might able copy it to another spreadsheet and concatenate the cells (e.g., you could then copy to Notepad, save it, and import it as a fix delimited field).

    I'm sharing a lot of theory here, as it may or may not work as described

  3. #3
    Registered User
    Join Date
    06-14-2007
    Posts
    3
    What short code can I type into the excel equation bar to take only:

    123
    123
    654
    654
    654
    789
    789
    963

    And make it (in some other column):

    123
    654
    789
    963

  4. #4
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    You can do the above by using advanced filter. Highlight the cells, select Data > Filter > Advanced Filter, select copy to new location, and check the unique records box.

    Jason

  5. #5
    Registered User
    Join Date
    06-14-2007
    Posts
    3
    Great.

    Any thoughts on the next (original) part? So now I have:

    123 a
    123 b
    654 d
    654 a
    654 r
    789 b
    789 q
    963 s

    AND:

    123
    654
    789
    963

    How can I get to:

    123 a,b
    654 d,a,r
    789 b,q
    963 s

  6. #6
    Registered User
    Join Date
    04-30-2006
    Posts
    55
    You could construct a matrix in which you lookup the matches in column b to the unique values in column a:

    transpose the unique set in C1:G1:
    {=transpose(array of unique dataset)}

    match the values in column b to that in a:
    C2=IF(B2=$A$2;C2;"") and copy down
    D2=IF(B2=$A$3;C2;"") etc.

    Use concatenate() to show the values and text in the format you like

    I think there should be a more efficient way, but this will work anyway...
    HTH

    Peter

+ 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