+ Reply to Thread
Results 1 to 13 of 13

Delete Duplicate Records

  1. #1
    Registered User
    Join Date
    05-28-2009
    Location
    Oakville, ON Canada
    MS-Off Ver
    Excel 2002
    Posts
    75

    Delete Duplicate Records

    I have a spreadsheet with a column of records (text ) from B1:B4000. I would like to delete the entire row of the duplicate record. Overall data set range is (A1:I4000). This spreadsheet may contain more than 1 duplicate record. Is there in easy fix?
    Thanks.
    Last edited by Foxcan; 07-16-2009 at 03:14 PM.

  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: Delete Duplicate Records

    Please clarify.

    After evaluating B1:B4000, delete ALL values that are duplicated or delete only the duplicates...thus leaving at least one unique value for each?

    A
    A
    B
    B
    B
    C
    D
    D
    E

    Shoud the list above become....
    A
    B
    C
    D
    E

    ...or
    C
    E
    _________________
    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 JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Delete Duplicate Records

    These two macros are only different in the colored line.
    Please Login or Register  to view this content.
    The first macro gives the result:
    C
    E
    ...from the original question I posed.

    The second macro gives the result:
    A
    B
    C
    D
    E
    Last edited by JBeaucaire; 07-15-2009 at 05:29 PM.

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

    Re: Delete Duplicate Records

    you could advanced auto filter on unique column b (filter in place,unique records only) then copy paste to a new sheet
    "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

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

    Re: Delete Duplicate Records

    Quote Originally Posted by Foxcan View Post
    I would like to delete the entire row of the duplicate record.
    I think that line makes it clear it's the original data he's looking to cull and not just make a list.

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

    Re: Delete Duplicate Records

    same thing surely? copy/paste all to new sheet?

  7. #7
    Registered User
    Join Date
    05-28-2009
    Location
    Oakville, ON Canada
    MS-Off Ver
    Excel 2002
    Posts
    75

    Re: Delete Duplicate Records

    Quote Originally Posted by JBeaucaire View Post
    These two macros are only different in the colored line.
    Thanks. This work PERFECT! This site is great thanks for everyones ideas!
    Last edited by shg; 07-17-2009 at 03:38 PM. Reason: deleted spurious quote

  8. #8
    Registered User
    Join Date
    06-24-2009
    Location
    Royersford, Pa
    MS-Off Ver
    Excel 2007
    Posts
    89

    Re: Delete Duplicate Records

    Hi everyone - this looks very interesting to me and I'd love to know how to make it work. The problem is though that I'm not sure I understand how to add the macro..not even a little bit.

    What do I actually write, where and.....well I'm just confused.

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

    Re: Delete Duplicate Records

    Hi CJax,

    One of the forum rules is to be sure and start your own thread instead of tacking on your own queries to someone else's.

    So, start a thread of your own and include links to this one if this has content you're trying to adapt.

    In your post, be sure to fully explain what your situation is, what you're trying to do, etc.

  10. #10
    Registered User
    Join Date
    06-24-2009
    Location
    Royersford, Pa
    MS-Off Ver
    Excel 2007
    Posts
    89

    Re: Delete Duplicate Records

    Hi JBeaucaire,

    Thanks. I read the forum rules when i joined but I didn't think I was post jacking with my question. I'm actually not trying to do anything except understand the answer given to Foxcan's question. Apparently the answer you gave here works well but I don't understand the answer.

    So, I'm not trying to apply this to any particular situation. Just trying to understand the answer given above to the situation described above. If I browse the forums just to learn techniques should I start a new thread everytime I have a question about an author's answer. I didn't think trying to understand a thread was the same as having my own situation i need help with.

  11. #11
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Delete Duplicate Records

    Jbeaucaire, I think it is okay in this instance to continue here for learning sake....as long as CJax doesn't start showing samples of trying to apply to his/her own work... then, I think it would require new thread with links (if necessary)
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

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

    Re: Delete Duplicate Records

    Quote Originally Posted by Cjax View Post
    If I browse the forums just to learn techniques should I start a new thread everytime I have a question about an author's answer. I didn't think trying to understand a thread was the same as having my own situation i need help with.
    Of course, you are correct. I apologize.

    And one of the things i *really* need to do better is put comments into the code itself to explain what's going on.

    Ok, let's start with your original question (which is what sounded like a topic change to me...)..."how to add a macro".

    ==========
    How to use add a macro:

    1. Open up your workbook
    2. Get into VB Editor (Press Alt+F11)
    3. Insert a new module (Insert > Module)
    4. Copy and Paste in your code (given above)
    5. Get out of VBA (Press Alt+Q)
    6. Save your sheet

    The macro is installed and ready to use. Press Alt-F8 and select it from the macro list.
    ==========

    If that's all you needed, great. If not, we can talk about the specifics of the macro itself. Here's the second macro with more "notes" added:
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 07-17-2009 at 10:44 PM.

  13. #13
    Registered User
    Join Date
    06-24-2009
    Location
    Royersford, Pa
    MS-Off Ver
    Excel 2007
    Posts
    89

    Re: Delete Duplicate Records

    Awesome - Thanks very very much for your explanation and I will be sure to be more clear in the future when jumping into other folks threads. Have a good one.

+ 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