+ Reply to Thread
Results 1 to 6 of 6

Removing duplicate on priority criteria

  1. #1
    Registered User
    Join Date
    06-19-2010
    Location
    Los Angles
    MS-Off Ver
    Excel 2003
    Posts
    4

    Question Removing duplicate on priority criteria

    Hello all site members ,
    I am a newbie in MS Excel.
    I have a excel sheet with 50K + records and consisting of 4 columns.website_name,email,fname,lname

    The website name field consist of 1 among these 5 websites ebay,amazon,bestbuy,wallmart,target

    I need to remove duplicate email id,such that email is which correspond to 'ebay' should not be present for amazon,bestbuy,wallmart,target..then in next iteration the email ids correspond to 'amazon' should not be there for bestbuy,wallmart,target...in 3rd iteration email ids correspond to 'bestbuy' should not be there for wallmart,target ..in 4th email id corresponding to 'wallmart' should not be there for target.
    Priority order to keep the email id is ebay>amazon>bestbuy>wallmart>target.
    I am wondering how can I do this.This is going to be a regular activity so I cant rely on manual cleansing.Can someone help me with the script/vba/macro to do this.or the logic to write program.

  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: Removing duplicate on priority criteria

    Can you post up a 15-20 row example data set showing before/after, just so it's perfectly clear?

    Click GO ADVANCED and use the paperclip icon to post up a desensitized copy of your workbook.
    _________________
    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
    Registered User
    Join Date
    06-19-2010
    Location
    Los Angles
    MS-Off Ver
    Excel 2003
    Posts
    4

    Question Re: Removing duplicate on priority criteria

    Thanks for your response.
    The attached excel file has 2 sample work sheet one is the original list and second is the result sample.I have highlighted few records to explain the scenario.
    Duplicate Email id which correspond to ebay(yellow) is removed for other websites(amazon,bestbuy,wallmart,target)...similarly duplicate email id which correspond to amazon removed for bestbuy,wallmart and target and so on.
    The priority to keep email id in list is ebay>amazon>bestbuy>wallmart>target.
    There are more duplicates in this sheet but I have not highlighted all of them to keep it simple.
    Final goal is to keep all email ids for ebay...removing all duplicate email ids from other...then for amazon..then for bestbuy ..and so on ...However retaining corresponding row fields (website,fname,lastname)
    Attached Files Attached Files

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

    Re: Removing duplicate on priority criteria

    This should do it.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    06-19-2010
    Location
    Los Angles
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Removing duplicate on priority criteria

    Thanks JB for your response

    I tried the code but it removed all rows rather than retaining the number of rows,Only cell value of 'email' column should go blank where the duplicate occurred keeping only one email id as per priority.
    For ex in the attached file if you see the sheet 2, email id(yellow highlight) which is already present in 'Ebay' is left blank for 'amazon','bestbuy','walmart' and 'target' .
    The row arrangement should not change in the result set.

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

    Re: Removing duplicate on priority criteria

    To do this quickly and easily I sorted all the rows together. Why would the order change be problematic?

    Anyway, try this, it will only clear email addresses (not rows) and the rows will be in their original order at the end.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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