+ Reply to Thread
Results 1 to 11 of 11

How to delete duplicate records using criteria for multiple rows

  1. #1
    Registered User
    Join Date
    08-13-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    88

    Question How to delete duplicate records using criteria for multiple rows

    Hi Guys,

    I have attached a spreadsheet with my three problems. The dataset is a plot of trees being measured over successive years.
    I want to find duplicate measurements and transparencies in the data between years. Once identified I want to be able to automatically delete / change them through script.

    The following problems can be seen in the provided excel file.
    Excel Validation Problems.xlsx

    Any advice on this issue would be great.

    Kind regards,
    Ardiko
    Last edited by Ardiko; 02-06-2013 at 07:11 AM.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to delete duplicate records using criteria for multiple rows

    Ardiko,
    I may be able to help with problem 1, but not the other two problems. Do Range (A-L) of two lines need to be equal so as to be duplciates, or just the years(Column G)? In other words, how do you identifay a cell, or a row is a duplicate?

  3. #3
    Registered User
    Join Date
    08-13-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    88

    Re: How to delete duplicate records using criteria for multiple rows

    Thanks AB33 for the reply. If the tree has the same Expt (a), Plot (b), Species (c), Treat (j), Year(g) and Code (k) it is a duplicate. I think I could make a IF statement myself to solve it but my main concern is that the data will be all over the place and I need to find the duplicates without having to sort and to automate the removal of them. If you can help with the initial problem of outlining them that would be great.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to delete duplicate records using criteria for multiple rows

    This will do and will look from Ato L, but can be amended if you just want to look at a,b,c,j. and g. Try it

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-13-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    88

    Re: How to delete duplicate records using criteria for multiple rows

    Cheers AB33! It works perfectly! I couldnt ask for one last final request if it is not time consuming? I would like to have the option of highlighting all duplicate cells before deletion with a "X" in the M column so I can filter for it. This would be an additional measure for myself so I know what I'm deleting just in case.

    Anyway no worries if you don't have the time to look at that.

    Once again thanks for your help and I'll re-edit this post so it only has the one problem and post my other ones in a separate thread.

    +rep

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to delete duplicate records using criteria for multiple rows

    Ardiko,
    The issue I have is when you indicate a row is a duplicate by colouring it, or indicating using "X", the next line of the code will delete it, unless ofcourse, you want to copy it to a separate sheet. I suggest you do the following: You have two separate codes, One is just to show you which rows have duplicates and the other code is to delete these rows.
    Change this line of code and try it and see what you think.

    Change this line of the code

    Please Login or Register  to view this content.
    INTO

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    08-13-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    88

    Re: How to delete duplicate records using criteria for multiple rows

    AB33 once again many thanks! This is very helpful!

    Would you be able to show me how to paste the discovered duplicates on to a tab beside it?
    I would also like to be able to call this sheet 'Duplicates'

    Thanks again!

  8. #8
    Registered User
    Join Date
    08-13-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    88

    Re: How to delete duplicate records using criteria for multiple rows

    Also AB33 I have a problem with the current code.

    In column L "Meas" for measurement a duplicate tree can have a different measurement if it has the same tree number with the same values on the same row. I might be bringing in two datasets for the same year but one could be updated therefore some of the plots will have very similar data but never will have more than one plot.

    Please see my updated spreadsheet.
    Validation Program v2.xlsm

    Cheers

  9. #9
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to delete duplicate records using criteria for multiple rows

    Ardiko,
    I am not sure what the issue you have. I have re-run the code on both sheets and could not find any duplicates. I have also added a duplcate row to test it and not only works, but also managed to copy the duplicate row in to duplciate sheet.If you do not want column L to be part of the test for the duplcate I can remove it from the code.

    Please see the attached.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    08-13-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    88

    Re: How to delete duplicate records using criteria for multiple rows

    Hi AB33,
    I suppose I don't want it to include column L then as a duplicate should show up with the other columns matching. If you can make that change it'd be great.

    Once again thanks for all your help.

  11. #11
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to delete duplicate records using criteria for multiple rows

    Okay, I have now removed column L from the criteria and found 3 duplicates and are copied to the duplciates sheet. Please find attached.
    Attached Files Attached Files

+ 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