+ Reply to Thread
Results 1 to 8 of 8

Remove rows when a column is found to contain multiple criteria

  1. #1
    Forum Contributor
    Join Date
    09-11-2014
    Location
    Eugene, Oregon
    MS-Off Ver
    MS EXCEL 2010
    Posts
    210

    Remove rows when a column is found to contain multiple criteria

    I have a download that contains anywhere from 10,000 to 60,000 rows and 11 columns. Column B contains the heading FUND ID and there is about 60 different Funds within that column. Currently I paste a look-up table that has each fund and either remove or Keep next to each fund. I then do a Vlookup and then I have to sort and delete any row that contains remove. Currently sorting that much data tends to be a slow process and I am looking to streamline this a bit. I have looked up some VBA on removing rows that contain a specific text or number but I can't find anything for this broad of a list and nothing seems to really cover what I need done. I just want to remove rows that contain these funds and shift the row up when one is deleted. Any help is appreciated.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Remove rows when a column is found to contain multiple criteria

    Hi,

    The quickest and simplest way I know of doing this sort of stuff is to use AutoFilter to filter the data for all the rows that you want to delete, then select the rows and hit the delete key.

    You can either do this manually or create a simple two or three line macro to do the task automatically. Use a helper column to hold your VLOOKUP and Autofilter for the word 'Remove'
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Remove rows when a column is found to contain multiple criteria

    Where are you getting the information in the Look-Up Table from? Sounds like you may have a list with items to remove?

  4. #4
    Forum Contributor
    Join Date
    09-11-2014
    Location
    Eugene, Oregon
    MS-Off Ver
    MS EXCEL 2010
    Posts
    210

    Re: Remove rows when a column is found to contain multiple criteria

    That's what I was trying to avoid All the funds that need to be removed are spread out so AutoFilter takes time adding the Vlookup takes time. Is there some VBA that will look at just that column and change any fund that needs to be removed to say Remove. I am thinking of something that will look at one column and if it contains X,Y, or Z change X,Y, or Z to the word Remove. Then I can at-least do a filter by just that word. here is the code I have so far to do this:
    Please Login or Register  to view this content.
    I thought about just repeating that code for each fund but that I would have to do that like 36 times.

  5. #5
    Forum Contributor
    Join Date
    09-11-2014
    Location
    Eugene, Oregon
    MS-Off Ver
    MS EXCEL 2010
    Posts
    210

    Re: Remove rows when a column is found to contain multiple criteria

    First, thank you for the quick responses I constantly recommend this forum to others at work because of this reason and the knowledge that it contains .

    So I currently have a list of the funds I want to remove and the funds I want to keep. I do A vlookup using that list and the FUND ID column and then I sort the VLOOKUP column for only removes. I just want to to try and implement some code that will make this task easier because right now I have to get the download and then Open up another Workbook that contains that list and paste that list into the workbook with the download and name the list and then do a vlookup. If I can't do my initial thought which was remove any row that contains the funds X, Y, Z, etc. and then shift up, I want to see how I can add a list to the above code so that it can do a find & Replace on multiple funds and not just one fund this is what I came up with after my last post

    Please Login or Register  to view this content.
    Except it would be much longer because I would have to repeat the code another 30 times to account for all funds and I have a feeling when I try to run that in a spreadsheet it might just break.

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Remove rows when a column is found to contain multiple criteria

    Quote Originally Posted by cmorten82 View Post
    That's what I was trying to avoid All the funds that need to be removed are spread out so AutoFilter takes time adding the Vlookup takes time.
    Autofilter will take longer if formulae are included. So the trick is to add the helper column with the VLOOKUP to your list of Funds and the Remove/Keep identifier, then copy the VLOOKUP formulae and paste back as values.

    Then, untested but assuming say column T is the helper column
    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Remove rows when a column is found to contain multiple criteria

    I was getting at something like this approach.

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    09-11-2014
    Location
    Eugene, Oregon
    MS-Off Ver
    MS EXCEL 2010
    Posts
    210

    Re: Remove rows when a column is found to contain multiple criteria

    Gotcha, so utilize the current table I have in place and use that in place of "Column With List" in the code. I will give it a shot thanks.

+ 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. Replies: 7
    Last Post: 03-13-2015, 05:34 PM
  2. [SOLVED] Search multiple Text Criteria in one column, and if found, rename it in a different column
    By gbloemke in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-24-2014, 07:18 AM
  3. Replies: 3
    Last Post: 03-31-2014, 01:00 PM
  4. [SOLVED] Remove multiple rows based on multiple cell's criteria
    By wyanrandy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-20-2012, 04:28 PM
  5. [SOLVED] Populate Listbox with a range from one worksheet (criteria) and remove if item found
    By Foreverlearning in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 05-08-2012, 07:31 AM
  6. [SOLVED] Remove all rows after Value is found in column
    By Hyflex in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-03-2011, 04:28 PM
  7. Remove data based on criteria from multiple columns and rows
    By jvegastn in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-09-2009, 11:42 AM

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