Excel User Group
Microsoft Excel blogs, forums, files. Read, ask questions, provide answers.

Comparing Two Columns in Excel Sheet

Latest post Sat, Apr 4 2009 12:20 AM by Steve Michael. 5 replies.
  • Thu, Mar 26 2009 4:56 AM

    Comparing Two Columns in Excel Sheet

    Hi,

      I need formula for comparing two columns. For Eg,

    Column A, Column B has datas, for Eg, In Column A has Names and Column B has E-mail Ids,

    If Both Name and Email Id repeates in the next row Column C should show its Duplicate Entry.

     

    Kindly Advice,

    Ram | ram@gmail.com | Unique

    Kumar | kumar@yahoo.com | Unique

    Ram | ram@gmail.com | Duplicate

     

    like this.

     

    I am waiting for your help.

     

    • Post Points: 37
  • Thu, Mar 26 2009 5:36 AM In reply to

    • Nick Hodge
    • Top 10 Contributor
    • Joined on Sun, Dec 23 2007
    • Southampton
    • Posts 543
    • Points 9,287
    • MVP

    Re: Comparing Two Columns in Excel Sheet

    Steve

    The first one is surely a duplicate also? (of the last one)

    There are many ways of identifying duplicates. I would point you to this site which lays out many options.

    http://www.cpearson.com/Excel/Duplicates.aspx

     

    Regards
    Nick Hodge
    Microsoft MVP, Excel
    Southampton, UK

    Filed under:
    • Post Points: 21
  • Thu, Mar 26 2009 6:18 AM In reply to

    Re: Comparing Two Columns in Excel Sheet

    Hi Nick,

        Thanks, But I need to Check both the cell at a time.

    • Post Points: 21
  • Thu, Mar 26 2009 6:31 AM In reply to

    • Nick Hodge
    • Top 10 Contributor
    • Joined on Sun, Dec 23 2007
    • Southampton
    • Posts 543
    • Points 9,287
    • MVP

    Re: Comparing Two Columns in Excel Sheet

    Steve

    Sorry, I'm not with you? Was there not a solution on the website I gave you? Remember to look for duplicates across multiple columns you will need to concatenate the data, possibly in a helper column, so for example, in column D enter

    =A1&B1

    and test against that. e.g your data would look like this in column D

    Ramram@gmail.com
    Kumarkumar@yahoo.com
    Ramram@gmail.com

    Regards
    Nick Hodge
    Microsoft MVP, Excel
    Southampton, UK

    Filed under:
    • Post Points: 5
  • Fri, Apr 3 2009 6:51 PM In reply to

    • Teppic_
    • Top 50 Contributor
    • Joined on Fri, Apr 3 2009
    • London UK
    • Posts 20
    • Points 228

    Re: Comparing Two Columns in Excel Sheet

     

    Steve

    This is just a demonstration of what Nick has said above...

    As Nick says you need to concatenate the information first (at least this is the easiest way). You can then use COUNTIF to test the uniqueness.

    Your example indicates that you do no wish to flag the 1st occurrence as being a duplicate, we can achieve this by making half the range in the COUNTIF dynamic, i.e. we only test against values above. Column C could be hidden if required. (this is the 6th example on the website Nick referenced).

     

    Code:

     

    A

    B

    C

    D

    1

    name1

    email1@addy1.domain

    =A1&"--"&B1

    =IF(COUNTIF($C$1:C1,C1)=1,"Unique","Duplicate")

    2

    name2

    email2@addy1.domain

    =A2&"--"&B2

    =IF(COUNTIF($C$1:C2,C2)=1,"Unique","Duplicate")

    3

    name3

    email2@addy1.domain

    =A3&"--"&B3

    =IF(COUNTIF($C$1:C3,C3)=1,"Unique","Duplicate")

    4

    name1

    email1@addy1.domain

    =A4&"--"&B4

    =IF(COUNTIF($C$1:C4,C4)=1,"Unique","Duplicate")

    5

    name5

    email5@addy1.domain

    =A5&"--"&B5

    =IF(COUNTIF($C$1:C5,C5)=1,"Unique","Duplicate")

     

     

     

     

     

     

     

     

     

     

     

    Result

     

    A

    B

    C

    D

    1

    name1

    email1@addy1.domain

    name1--email1@addy1.domain

    Unique

    2

    name2

    email2@addy1.domain

    name2--email2@addy1.domain

    Unique

    3

    name3

    email2@addy1.domain

    name3--email2@addy1.domain

    Unique

    4

    name1

    email1@addy1.domain

    name1--email1@addy1.domain

    Duplicate

    5

    name5

    email5@addy1.domain

    name5--email5@addy1.domain

    Unique

    Hope this helps,

    Regards,

    Teppic

    • Post Points: 21
  • Sat, Apr 4 2009 12:20 AM In reply to

    Re: Comparing Two Columns in Excel Sheet

    Ya thanks for all of yours help. yes atlast as Nick referred, I did it.

     

    A1 | B1 | =(A1&B1) | Unique

    Thanks for your idea.

    Its working for me. :) 

    • Post Points: 5
Page 1 of 1 (6 items) | RSS
Copyright Excel User Group and the relevant contributors, 2010. All Trade Marks acknowledged. This site is a peer-to-peer site and NOT affiliated in any way to Microsoft Corp. All rights reserved.