Closed Thread
Results 1 to 8 of 8

Macro to Compare Columns A & B and dispaly any duplicates in Columns C & D

  1. #1
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Macro to Compare Columns A & B and dispaly any duplicates in Columns C & D

    Hi,

    what I'm after is a macro to check the contents of Column 'A' against column 'B' and display any duplicates in Columns 'C' & 'D'.

    N.B. The headings of Columns C & D are :-

    C = Value Found in Column A

    D = Value Found in Column B

    Any duplicate entries logged in columns C & D should be listed in C2,C3,C4....C20 and D2,D3,D4......D20 etc (in effect creating two new lists)

    Any assistance would be greatly appreciated


    Regards


    Rob

    Excel version 2003
    Last edited by VBA Noob; 02-27-2009 at 08:09 AM.
    Rob

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to Compare Columns A & B and dispaly any duplicates in Columns C & D

    Clarification:

    C1 =Value from Column A found in Column B
    D1 =Value from Column B found in Column A

    Correct?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Macro to Compare Columns A & B and dispaly any duplicates in Columns C & D

    why 2 lists? if its found in both columns then one will suffice surely , if a is found in b then the reverse would be true, so columns c and d would be the same.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to Compare Columns A & B and dispaly any duplicates in Columns C & D

    Martin is right, I think. Only one macro and one column is really needed:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Question Clarification of Requirements

    Many thanks to JBeaucaire & martindwilson for taking the time to get back to me it is very much appreciated.

    Having said that, my colleague has ever so slightly changed the goals posts !

    What he has is two columns of Text i.e. columns 'A' and 'B' and what he would like is a macro to generate the following:-

    (a) In column 'C' he wants a unique list of data from columns 'A' & 'B' i.e. no duplicates.

    (b) In column 'D' he wants a list of items that only appear in column 'A'

    (c) In column 'E' he wants a list of items that only appear in column 'B'


    Any assistance would be most welcomed.

    Best Regards


    Rob


    N.B. Excel version 2003

  6. #6
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Thumbs up Re: Macro to Compare Columns A & B and dispaly any duplicates in Columns C & D

    Original Request resolved- many thanks to all who replied

    Thanks again


    Regards


    Rob

  7. #7
    Registered User
    Join Date
    06-20-2013
    Location
    hyderabad
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: Macro to Compare Columns A & B and dispaly any duplicates in Columns C & D

    Hey robert ,

    can you post the final code for this ? i could use it for my macro .

    thanks
    ram

  8. #8
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Macro to Compare Columns A & B and dispaly any duplicates in Columns C & D

    @ rampulaparthi

    This is a 4 years old thread...So:

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Compare the 1st 9 digits in two columns looking for duplicates
    By Sweetetc in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 05-18-2016, 06:19 AM
  2. Compare two columns delete duplicates
    By camo090 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-16-2013, 03:59 PM
  3. Replies: 6
    Last Post: 12-26-2012, 01:43 PM
  4. Compare 2 columns and mark the duplicates
    By powpowninjastar in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-12-2010, 10:06 PM
  5. [SOLVED] compare two columns and remove duplicates
    By Moni39 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-05-2005, 02:06 PM

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