+ Reply to Thread
Results 1 to 4 of 4

compare two lists - delete from second items that are not on first

  1. #1
    Forum Contributor
    Join Date
    03-11-2010
    Location
    India
    MS-Off Ver
    2010
    Posts
    268

    compare two lists - delete from second items that are not on first

    I have a master list, and a detail list.
    From detail list, I want to delete items that are not on master list.
    i am using below code.

    Please Login or Register  to view this content.
    Is there a faster way to achieve this?

    Thanks
    Ajay

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: compare two lists - delete from second items that are not on first

    Hi Ajay,

    Why not create a Helper column on the detail sheet that does a Match of the list on the Master. It will come back with either a number, showing it is on the master; or an error in that helper column.
    Then you can only deal with a single detail sheet and remove rows where the helper column is an error. I think that would be much quicker than your above.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,909

    Re: compare two lists - delete from second items that are not on first

    Or you can make use of dictionaries.

    https://www.excelforum.com/excel-pro...ml#post4693781
    Last edited by bakerman2; 07-16-2017 at 04:11 AM.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Forum Contributor
    Join Date
    03-11-2010
    Location
    India
    MS-Off Ver
    2010
    Posts
    268

    Re: compare two lists - delete from second items that are not on first

    Thanks for your inputs.
    I found

    Please Login or Register  to view this content.
    to be fastest of all options I tried to populate helper column.

+ 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. Compare 2 lists and output unmatched items using array
    By Xceller in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-27-2013, 07:19 AM
  2. Replies: 0
    Last Post: 01-15-2013, 11:30 AM
  3. Compare Lists, Show unduplicated items
    By lil_ern63 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-29-2006, 05:54 PM
  4. How do I compare two lists and choose the items that are in both?
    By laurabailey8 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-03-2006, 07:35 PM
  5. [SOLVED] Formula to compare two lists and separate non-recurring items?
    By Tennessee in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-10-2005, 02:35 PM
  6. [SOLVED] Compare 2 columns, and create a list of items that are in both lists
    By ruby2sdy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-08-2005, 07:05 AM
  7. [SOLVED] Compare 2 lists and if not on list then delete row
    By Jan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-06-2005, 01:06 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