+ Reply to Thread
Results 1 to 7 of 7

Deleting duplicate rows

  1. #1
    Registered User
    Join Date
    07-26-2012
    Location
    Kansas City
    MS-Off Ver
    Excel 2010
    Posts
    3

    Deleting duplicate rows

    The issue I'm facing in the attached file is this. I need a VBA Macro that first, checks to see if there is any duplicate data that matches column A AND column B. I.E. If the last name is the same, is the first name ALSO the same. If so, keep going down the list to identify ALL rows that have duplicate data in column A AND column B (this could be as few as 2 rows, or many more). Next it needs to search column E for ONLY the rows that A AND B have duplicates in. If it finds ANY occurrence of the word "No", it deletes all other duplicate rows (leaving me with one row and the word "No" is still resident in column E. If it doesn't find any occurrence of the word "No" in column E, it simply deletes all rows except for one. This is quite confusing to me on how one goes about completing this with a VBA Macro. I am somewhat familiar with macros and am already using a few to manipulate data on other spreadsheets, but this one is just getting the better of me.

    Any help is greatly appreciated!!
    Attached Files Attached Files
    Last edited by JBeaucaire; 07-26-2012 at 05:45 PM. Reason: Corrected thread title to topic only, as per forum rules

  2. #2
    Forum Contributor
    Join Date
    07-26-2012
    Location
    USA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    351

    Re: Deleting duplicate rows

    Question: would using a formula to combine columns A and B pose a problem for you? I think I can figure this out if combining the 2 columns is ok, maybe even throw them onto a new sheet in case that does indeed pose a problem for you

  3. #3
    Registered User
    Join Date
    07-26-2012
    Location
    Kansas City
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Deleting duplicate rows

    If I had a good formula, I could probably convert to a macro. As for combining the columns, I don't see a problem with that either. Thanks so much!!

  4. #4
    Registered User
    Join Date
    02-10-2012
    Location
    Penang, Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: Deleting duplicate rows

    Hi,

    Please refer to the attached, I've created a simple macro but please ensure you must name your Sheet as "List" in order to run the macro. If you like my macro, please give me a star at the right hand corner of this post.

    Thanks and have a great day!

    Rgds,
    Catherine
    Attached Files Attached Files

  5. #5
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Deleting duplicate rows

    Provided your data is sorted as per your sample, try this ...

    In G2 (Helper column, hide with Grouping button) Drag down as required.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Then in H2 Drag Across to K2, Then Down until a blank row is returned.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    In L2 Drag down as required.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Sorry can't post a sample workbook, but will do once the "Tech Team" gets its act together, that might be some little while ...

    [EDIT]
    Must have been that nasty guy "Spike" again. Wait 'til the "Tech Team" get their hands on him ...

    Here's the attachment.
    Attached Files Attached Files
    Last edited by Marcol; 07-27-2012 at 07:12 AM.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  6. #6
    Registered User
    Join Date
    07-26-2012
    Location
    Kansas City
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Deleting duplicate rows

    Thanks so much Catherine. That works like a champ!!! I have added information to your reputation.

    ---------- Post added at 02:36 PM ---------- Previous post was at 01:09 PM ----------

    Marcol,

    This option also works, however, every time a new member is added, you have to re-drag the help row. The macro Catherine provided does it automatically as part of the whole data collection process. Thanks though!!

  7. #7
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Deleting duplicate rows

    Before you start, drag the helper as far as you might reasonably expect your data to go, it wont eat you out of house and home.

    I only offered this as a solution using native formula, often macros are prohibited by the end user, and indeed some proud owners of macs don't have access to VBa ...

    Native formula often seems to be an endangered species ...

    Happy to have helped ...
    Last edited by Marcol; 07-27-2012 at 09:59 PM.

+ 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