+ Reply to Thread
Results 1 to 5 of 5

Deleting rows that are NOT duplicates

  1. #1
    Registered User
    Join Date
    04-23-2015
    Location
    Michigan
    MS-Off Ver
    10
    Posts
    2

    Deleting rows that are NOT duplicates

    I posted this in the Macros forum also, but thought it might be more appropriate here.

    We work with price files that are up to 300,000 rows or more. We need to find the rows that are duplicate part #'s (easy), but then we need to delete everything that's NOT a duplicate. Deleting duplicates simple, deleting non-duplicates, not as simple.

    Can someone help us come up with a way to do this?

    Thanks,
    E-

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Deleting rows that are NOT duplicates

    Hi, welcome to the forum

    I have closed your other thread, forum rules preclude posting duplicate threads.

    1 way to do this would be to use a helper column, like this...
    A
    B
    1
    ID Helper
    2
    aa
    2
    3
    bb
    2
    4
    dd
    1
    5
    cc
    1
    6
    ee
    1
    7
    aa
    2
    8
    bb
    2

    B2=COUNTIF(A:A,A2)
    copied down.

    You would then apply filters (Home tab/Editing/SortsAndFilter/Filter
    on the dropdown, uncheck ALL and check 1
    delete all rows that remain
    Remove the filter

    You should be left with only duplicate ID's
    You can then (if you want) delete the helper column
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Deleting rows that are NOT duplicates

    Hi e,

    Welcome to the Forum! (I posted this in the thread closed by Ford)

    Please Login or Register  to view this content.



    Directions for running the routine(s) just supplied

    If you haven't used macros before you'll need to go to:
    File- options - trust center -trust center settings - macro settings ,
    the second option down (disable all macros with notification)

    Then - Copy the code to the clipboard

    Open your Workbook

    Press ALT + F11 to open the Visual Basic Editor.

    Select "Module" from the Insert menu

    Type "Option Explicit" then paste the code under it

    With the cursor between Sub and End Sub press F5 (F8 to Single Step)

    OR

    Press ALT + Q to close the code window.

    Press ALT + F8 then double click on the macro name
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Deleting rows that are NOT duplicates

    @ Orrin, apologies, must have been a timing issue, I did not see your post, otherwise I would have closed this 1

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Deleting rows that are NOT duplicates

    @Ford - Not to worry, it was no problem since you had also posted the link

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Cleaning rows of data and clean rows of duplicates not deleting.
    By guidom in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-21-2014, 12:48 PM
  2. Deleting Duplicates across rows
    By caunyd in forum Excel General
    Replies: 3
    Last Post: 08-06-2013, 03:08 PM
  3. Deleting duplicates in a range of rows
    By Mkkl in forum Excel General
    Replies: 7
    Last Post: 04-16-2013, 06:18 AM
  4. [SOLVED] Deleting rows based on duplicates in one column only
    By KD70 in forum Excel General
    Replies: 8
    Last Post: 10-12-2012, 03:07 PM
  5. Replies: 4
    Last Post: 12-04-2007, 03:08 PM

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