+ Reply to Thread
Results 1 to 5 of 5

Checking column for duplicate values and appending

  1. #1
    Registered User
    Join Date
    03-09-2008
    Location
    Columbia, CT USA
    Posts
    5

    Smile Checking column for duplicate values and appending

    Hi -

    Thanks in advance for taking a look at this complicated problem!

    I have a column of numbers in Column A. The numbers in column A may or may not be unique (some are duplicates). Each number in column A has a corresponding value in column B. I'd like to start in cell A1 and check cell A2's value. If a1=a2, I'd like the value in b2 to be appended to whatever value is in b1 (with a comma separator). Then I'd like to check to see if a2=a3. If it does, I'd also like this appended to b1. If its not equal, I'd like check a3 against a4. if it's equal append the value of b4 to b3, etc.. If possible, I'd like to replace the values I'm appending and delete them from their current cell. It might be easier to show an example:

    I'd appreciate any / all help!

    BEFORE:
    Column A Column B
    01111109 EAGF
    01111109 EAOF
    01111109 EBOE
    01111154 EAGF
    01111154 EAOF
    01111166 EAGF
    01111166 EALZ

    AFTER
    Column A Column B
    01111109 EAGF,EAOF,EB0E
    01111154 EAGF,EAOF
    01111166 EAGF,EALZ

    etc. Column A is actually over 5,000 rows long.


    Thanks in advance, Lee

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606
    Here is one approach (which doesn't require identical entries to be adjacent):
    Please Login or Register  to view this content.
    Last edited by StephenR; 05-11-2008 at 01:02 PM.

  3. #3
    Registered User
    Join Date
    03-09-2008
    Location
    Columbia, CT USA
    Posts
    5
    Hi -

    Thank you VERY much for the reply. When I run the macro, I receive the following :

    Microsoft Visual Basic

    Run-time error '-2147417848 (80010108)':

    Method of 'Transpose' of object 'Worksheetfunction' failed

    Did I do something wrong?

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606
    Not sure - could you attach a small sample of your data?

  5. #5
    Registered User
    Join Date
    03-09-2008
    Location
    Columbia, CT USA
    Posts
    5

    Smile

    Never mind - my fault. I was using an earlier version of the spreadsheet that had multiple worksheets. Your VB script worked like a champ!!!!! I can't tell you how much I truly appreciate your help.

    I was trying to do this manually - cutting and pasting. Your help saved me several hours of work tonight, as I needed this for tomorrow. Thanks again!!!!

    Lee

+ 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