+ Reply to Thread
Results 1 to 5 of 5

Compare List A to List B and Return Duplicates to C

  1. #1
    Registered User
    Join Date
    12-02-2009
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    3

    Compare List A to List B and Return Duplicates to C

    Hopefully someone out there can help. I need help creating a macro which compares 2 columns of data and all duplicates written to a third column. Here are the steps I believe need to happen, but I'm having trouble translating it to VBA code...

    Write a for loop with “If Statements”
    Compare A to B to see if it is equal if it is write it to C and move on to the next A
    If A is not equal to B move to the next B and repeat (so each A is being checked against every B until a match is found or all B's have been checked)
    Once a match is found or all B's have been checked repeat the process with the next A

    I know it will take a clever solution, so any help is most appreciated! Thanks in advance for your time.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Compare List A to List B and Return Duplicates to C

    Why a macro?

    In C1 and copy down =IF(ISNUMBER(MATCH(A1,B:B, 0)), A1, "")
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    12-02-2009
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Compare List A to List B and Return Duplicates to C

    Thanks for the reply, but its more complicated than that. I cant just compare A with the B right next to it. I need to compare every A with every B, not just the values in one row.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Compare List A to List B and Return Duplicates to C

    If you drag the formula down the extent of the data in col A as suggested, it will do exactly that.

  5. #5
    Registered User
    Join Date
    12-02-2009
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Compare List A to List B and Return Duplicates to C

    Wow. your right, that does solve the problem. Thats why your the moderator! I cant thank you enough!

+ 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