+ Reply to Thread
Results 1 to 5 of 5

Remove unique rows and keep duplicates

  1. #1
    Registered User
    Join Date
    10-26-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Question Remove unique rows and keep duplicates

    Hello,

    Currently, my spreadsheet is advanced filtered to remove duplicates considering both columns. My goal is to have a list of Names (Column B) that have a duplicate in Column B, but a different ID in Column A. All of the names in Column B that do no have a duplicate in Column B, need to be removed. I tried running a macro from this forum, but received an error message.

    Attached is a sample of current and goal data (remove non-duplicated names in red font):

    Current
    ID Name
    26594 17-amino acid co
    39757 17-amino acid co
    20084 18-amino acid
    311 2-propanol

    3725 2-pen
    8300 2-pen
    23380 20/20 artficl tear
    2005 222
    2236 222

    Goal
    ID Name
    26594 17-amino acid co
    39757 17-amino acid co
    3725 2-pen
    8300 2-pen
    2005 222
    2236 222

    Any help is appreciated.
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,865

    Re: Remove unique rows and keep duplicates

    This solution is for Excel versions earlier than 2007.
    First, I would do a conditional format on all duplicates. Use the formula found in this link on Column B.

    http://office.microsoft.com/en-au/ex...001136616.aspx

    then create a UDF as shown here

    http://www.datapigtechnologies.com/f...rtonColor.html

    Once you have sorted the file by color, you can then delete the appropriate rows very quickly.

    For 2007 users, use conditional format wizard, sort and delete.

    Alan
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    10-26-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Remove unique rows and keep duplicates

    Thank you Alan,

    I will give it a try.

    Terry

  4. #4
    Registered User
    Join Date
    08-01-2010
    Location
    American in Rovereto, Italy
    MS-Off Ver
    Excel 2010 home & Excel 2010 work
    Posts
    46

    Re: Remove unique rows and keep duplicates

    Hello Terry,
    I wrote a function to move duplicates to another sheet.
    Take a look, maybe it will suit your needs.

    Gordon in Rovereto Italy

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Gordon in Rovereto, Italy

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

    Re: Remove unique rows and keep duplicates

    simplest is to count them .
    in a spare column on the same row assuming data starts in b2
    =countif(B:B,B2)>1
    auto fill down to end of data in col b
    now filter that column by false
    you can now delete those rows in on go
    or else filter on true and copy visible rows to somewhere else to work on

    on re -reading this i see you are already using advanced filter since you know how to do it why not reverse the criteria so as to filter on those you dont want, then simply delete the entire lot of visible rows
    Last edited by martindwilson; 11-02-2010 at 09:38 AM.
    "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

+ 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