+ Reply to Thread
Results 1 to 11 of 11

Comparing 2 columns and deleting duplicates in the second column according first column

  1. #1
    Registered User
    Join Date
    03-30-2009
    Location
    Pennsylvania, United States
    MS-Off Ver
    Excel 2003
    Posts
    11

    Comparing 2 columns and deleting duplicates in the second column according first column

    I've looked all over the place for hours trying to find this answer with no success. It seems simple, but apparently is not

    In general, this is what I'm trying to do:

    I want to find values in a second column that are duplicates of values in the first column, and delete those second column duplicates Without deleting the duplicates (which do exist) in the first column. I've tried it all, and have only figured out about 300 ways that Do Not work. Hopefully someone here can figure out one way this Will work!

    thanks in advance
    -Ryan

  2. #2
    Valued Forum Contributor
    Join Date
    07-27-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    826

    Re: Comparing 2 columns and deleting duplicates in the second column according first colum

    wingo033, can you upload a small sample workbook, and the "300 ways that do not work" (class!!) should stay at 300.
    Brendan.


    __________________________________________________________________________________________________
    Things to consider:

    1) You can thank any poster by clicking the * at the left of a helpful post.
    2) You can help to keep the forum tidy by marking your thread as "Solved", if it has been answered to your satisfaction.
    3) Help us to help you, by uploading a sample workbook, showing the type of data you're dealing with, and clearly indicating what the results should be.

  3. #3
    Registered User
    Join Date
    03-30-2009
    Location
    Pennsylvania, United States
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Comparing 2 columns and deleting duplicates in the second column according first colum

    Here is a small sample of a much, much larger spreadsheet. If you look at the spreadsheet, you'll notice 3 columns - 2 with Parcel IDs and 1 with the "API No." Notice that there are frequently multiple API #s per parcel ID. I bring this data into excel via highly complex mapping software as two separate data sets. One data set contains all parcels within a one mile radius of a certain "subject parcel." The second data set contains every oil well located within a one mile radius of the "subject parcel" along with the parcel ID that the well is located. All too often, much of this data overlaps.

    Without getting too in depth, and since this data is imported as two separate sets with overlapping contents, I need a way to identify values in the "Parcels 1" column that are duplicates of any number in the "Parcels 2" column and delete them - without affecting data from the "Parcels 2" column.

    Good luck to us all on this one!

    thanks
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    09-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    929

    Re: Comparing 2 columns and deleting duplicates in the second column according first colum

    Hi wingo,

    Here's my take... it's a 4 step process, but it seems to work on my end...

    Let me know if you don't understand...

    Take care,
    Dennis
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor
    Join Date
    09-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    929

    Re: Comparing 2 columns and deleting duplicates in the second column according first colum

    Sorry, forgot to mention... the formula in the helper column can be any formula that you come up with... as long as you categorize them into text vs. number... the Go To Special can choose either one... depending on what you want to highlight...

    I can't emphasize enough that I'm a big fan of Go To Special... especially if used properly...

    re-post: I misunderstood what you wanted to do with Parcels 2, I'm assuming you want to keep the integrity of the record in the row, so instead of right click, delete, shift cells up... simply just delete the Go To Special selection... hope that makes sense... let me know if I confused you more...
    Last edited by djapigo; 11-19-2012 at 05:58 PM.

  6. #6
    Registered User
    Join Date
    03-30-2009
    Location
    Pennsylvania, United States
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Comparing 2 columns and deleting duplicates in the second column according first colum

    Djapigo,

    Thanks for the response. There seems to be a problem with the uploaded file in your post, it keeps saying file is corrupted when I try to open it - do you think you can re-upload it for me?

    thanks

  7. #7
    Valued Forum Contributor
    Join Date
    09-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    929

    Re: Comparing 2 columns and deleting duplicates in the second column according first colum

    Sorry Wingo,

    Let me just write it here instead…
    Step 1. Use the formula in a helper column (just make sure the "0" (false part) is a number if the lookup is text, or vice versa), I would insert a new column C and use this formula… =IF(ISNA(VLOOKUP(B2,$A$1:$A$17,1,0)),B2,0)

    Step 2. Highlight column C, press F5, Special (Go To Special) and choose Formula and uncheck the Text, Logicals, and Errors (choose Text only if false part in Step 1 is text)… click OK

    Step 3. Delete the new highlighted section (or if you want to remove the blank spaces too… right click on the selected range in column C, choose Delete, Shift Cells Up)

    Step 4. Paste Special Value (to remove the formulas, note this can be done in Step 1.5, but instead of Formula in Go To Special, choose Constants

    Let me know if this does not make any sense… or if it doesn’t work…

    -Dennis

    PS Check out my re-post from my previous entry...

    PPS I'm using Excel 2010, I wonder that's why you couldn't open it... weird though, I thought I saved it as an xls file... hmmm...
    Last edited by djapigo; 11-19-2012 at 06:06 PM.

  8. #8
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Comparing 2 columns and deleting duplicates in the second column according first colum

    Hi wingo033

    if you do a search on this site, this subject has been discussed a few times. Here's a couple of links.

    http://www.excelforum.com/excel-gene...ne-column.html

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

  9. #9
    Registered User
    Join Date
    03-30-2009
    Location
    Pennsylvania, United States
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Comparing 2 columns and deleting duplicates in the second column according first colum

    Dennis, thanks for the effort. I''m not sure I understand it completely because I can't get it to work. Essentially, I need any number in column 1 that is a duplicate of any number in column 2 deleted automatically (but leaving column 2 untouched). The formula you provided doesn't seem to do that, however the fault could definitely be my own here. I'm looking for something that will automatically delete my target duplicates in column 1, as anything other than automatic will take weeks/months (there are over 30,000 entries). I'm kinda lost on your suggestion, sorry about that

  10. #10
    Valued Forum Contributor
    Join Date
    09-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    929

    Re: Comparing 2 columns and deleting duplicates in the second column according first colum

    That's too bad... I suggest you check Kevin's suggestion... someone posted some VBA coding that seems to work... good luck...

  11. #11
    Registered User
    Join Date
    03-30-2009
    Location
    Pennsylvania, United States
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Comparing 2 columns and deleting duplicates in the second column according first colum

    Well, using the MATCH function as noted in one of the links Kevin suggested, I got it to work. It seems like a very roundabout way of accomplishing what I want, but I guess it gets the job done.

+ 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