+ Reply to Thread
Results 1 to 15 of 15

Comparing data between 2 sheets to find duplicates

  1. #1
    Registered User
    Join Date
    01-13-2012
    Location
    MI
    MS-Off Ver
    Excel 2003 and 2010
    Posts
    14

    Comparing data between 2 sheets to find duplicates

    Hi,

    I have 2 spreadsheets, one with our current database of about 45000 names and emails and another of about 250000 names and emails. I need to compare the 2 sheets to find any duplicate emails that are on the database sheet and on the 250000 sheet.

    Once I find the emails on the 250000 sheet that are already in our database, I need to remove them from the 250000 sheet.

    Is there a quick and easy way to do this?

    Any help would be greatly appreciated.

    Thanks so much!

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Comparing data between 2 sheets to find duplicates

    hi redheadinlove, assuming your names are in column A & Emails in Column B, & the 45000 names are in the worksheet named "Sheet1", put this formula in the worksheet with 250,000 names:
    Please Login or Register  to view this content.
    Do an autofilter in this worksheet. Anything that is NOT #N/A is a duplicate.

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Valued Forum Contributor
    Join Date
    04-03-2012
    Location
    East Sussex, UK
    MS-Off Ver
    Excel 2003:2010
    Posts
    893

    Re: Comparing data between 2 sheets to find duplicates

    A simple COUNTIF and filter to delete should do the job.

    =COUNTIF([Workbook2.xlsx]Sheet1!$A$2:$A$45000,A2)

    Put the above formula in the the first row (in this example it's row 2, change the A2 at the end of the formula to reflect the cell your first email address on the 250000 sheet is in) and copy down. You will also need to change the file and sheet name to reflect yours.

    When calculated filter the data to anything other than zero and those are your rows of data that appear on both workbooks.

    Hope that helps. Let me know if you need further clarification.

    S.
    Last edited by Spencer101; 05-30-2012 at 02:00 AM.

  4. #4
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Comparing data between 2 sheets to find duplicates

    @ Spencer101
    =COUNTIF([Workbook2.xlsx]Sheet1!$A$2:$A$45000,A2)
    won't that just count the duplicates existing in Sheet1 of Workbook2?

  5. #5
    Valued Forum Contributor
    Join Date
    04-03-2012
    Location
    East Sussex, UK
    MS-Off Ver
    Excel 2003:2010
    Posts
    893

    Re: Comparing data between 2 sheets to find duplicates

    It's doing exactly the same thing as your example, effectively.

  6. #6
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Comparing data between 2 sheets to find duplicates

    sorry, dont know what i was thinkin!

  7. #7
    Valued Forum Contributor
    Join Date
    04-03-2012
    Location
    East Sussex, UK
    MS-Off Ver
    Excel 2003:2010
    Posts
    893

    Re: Comparing data between 2 sheets to find duplicates

    Just to clarify, the formula gave above should be entered into the first relevant row of the workbook you're looking to delete rows from, the 250000 row of data one I presume from the original post.

    It will check each row against the "database" workbook and if it finds the relevant email address in that file it will show how many times it appears.

    If zero, it does not appear, if 1 it appears once, if 2 it appears twice on the database workbook etc...

  8. #8
    Registered User
    Join Date
    01-13-2012
    Location
    MI
    MS-Off Ver
    Excel 2003 and 2010
    Posts
    14

    Re: Comparing data between 2 sheets to find duplicates

    Thanks! I am sorry if I didn't give enough information.

    Sheet 1 has 239407 records, names in A emails in B.

    Sheet 2 has 52555 records, names in A emails in B.

    I am not very good with formulas so I haven't been able to get the ones both of you gave to work.

    Thanks!

  9. #9
    Valued Forum Contributor
    Join Date
    04-03-2012
    Location
    East Sussex, UK
    MS-Off Ver
    Excel 2003:2010
    Posts
    893

    Re: Comparing data between 2 sheets to find duplicates

    So presuming the first name on Sheet1 is in cell A2 and the corresponding email address is in cell B2. select cell C2 and enter =COUNTIF(SHEET2!B2:B52555,B2) then press return. Copy and paste this cell (C2) down to the last populated row on Sheet1 and that's the first part done.

    Then just a case of applying the auto filter and filtering it to those that do not show zero. These are the email addresses that appear on Sheet2 as well as Sheet1.

    Does that help at all?
    Last edited by Spencer101; 05-30-2012 at 02:01 PM.

  10. #10
    Registered User
    Join Date
    01-13-2012
    Location
    MI
    MS-Off Ver
    Excel 2003 and 2010
    Posts
    14

    Re: Comparing data between 2 sheets to find duplicates

    Yes, but I copied it down and it seems like every cell in the column says #VALUE!

    Is that right?

    Also, how do I apply the auto filter and filter it to those that do not show zero?

    Thanks so much for all the help.

  11. #11
    Valued Forum Contributor
    Join Date
    04-03-2012
    Location
    East Sussex, UK
    MS-Off Ver
    Excel 2003:2010
    Posts
    893

    Re: Comparing data between 2 sheets to find duplicates

    Sorry, forgot to lock the cell refs in the formula. Try =COUNTIF(SHEET2!B$2:B$52555,B2) and then copying it down. You should have none that say #VALUE! then. (fingers crossed!)

    As for adding the filter, select any cell in your header row (row 1 for example) and type "Alt D F F" (if you're using Excel 2010 you can type them one after the other, if using Excel 2003 you will have to type DFF whilst holding down Alt).

    That will apply the filter, then select the filter arrow in the relevant column (column C in my example above).
    How you restrict it to non zeros will differ depending on which Excel version you're using at the moment, but neither should be difficult to fathom.

    Let me know if you get stuck.

  12. #12
    Registered User
    Join Date
    01-13-2012
    Location
    MI
    MS-Off Ver
    Excel 2003 and 2010
    Posts
    14

    Re: Comparing data between 2 sheets to find duplicates

    Thanks, but it is still saying value and it keeps opening a window like I am supposed to browse and find a file. Sheet 1 and 2 are in the same workbook, is that a problem?

  13. #13
    Valued Forum Contributor
    Join Date
    04-03-2012
    Location
    East Sussex, UK
    MS-Off Ver
    Excel 2003:2010
    Posts
    893

    Re: Comparing data between 2 sheets to find duplicates

    You have to make sure the "Sheet2" part of the formula is the same as the sheet you're looking up from.

    So if that is "Sheet 2" (with a space) rather than "Sheet2" (without a space) then alter the formula to reflect that.

    Alternatively, post a small sample of the workbookand I'll put the formula in for you so you can just copy and past from that into your proper workbook.

  14. #14
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,873

    Re: Comparing data between 2 sheets to find duplicates

    An alternative to this is to use MS Query bump the two tables against each other. If you are interested, here is a link on how this would work.

    http://www.exceluser.com/explore/msquery1_1.htm

    And as another resource which I prefer is to use Access and create an unmatched query using the wizard.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  15. #15
    Registered User
    Join Date
    01-13-2012
    Location
    MI
    MS-Off Ver
    Excel 2003 and 2010
    Posts
    14

    Re: Comparing data between 2 sheets to find duplicates

    Well I feel dumb, the space was the problem.

    Thank you all so incredibly much for you help. I was able to get it to work.

+ 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