+ Reply to Thread
Results 1 to 14 of 14

remove groups of rows that don't meet a qualifiction

  1. #1
    Forum Contributor
    Join Date
    03-14-2013
    Location
    FL
    MS-Off Ver
    Excel 2013
    Posts
    123

    remove groups of rows that don't meet a qualifiction

    I have an excel sheet that is about 100,000 rows. I'm trying to pull out any Code that has a PAU Coverage and either a HO3 coverage or HO6 coverage. I coded the coverages as keys to try and help. 1 is for PAU and 2 is for HO3 and HO6.

    I tried creating a pivot table for it but could not figure out how, I think that may be to complex to complete with Pivots.
    Attached Files Attached Files

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: remove groups of rows that don't meet a qualifiction

    Why not just turn on Autofilter, filter on the Coverage column and select the codes you don't want. Select the visible rows except the header and use the Delete icon on the ribbon to remove them.

    Suggest you make a backup first and make judicious use of Undo where necessary.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  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 groups of rows that don't meet a qualifiction

    In your after sheet you have codes which do not reflect your criteria in Column D? Am I missing something? Or does this help?

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    03-14-2013
    Location
    FL
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: remove groups of rows that don't meet a qualifiction

    Forgot to clarify that. If the code has PAU and either HO3 or HO6 I want to keep everything from that code that meets the criteria.
    That's why on after there are coverages that don't match PAU HO3 or HO6, because the code meets the criteria everything from the code stays.

    Your macro does what I first asked, however are you able to modify it a little?
    Last edited by kleptilian; 10-28-2015 at 08:01 AM.

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

    Re: remove groups of rows that don't meet a qualifiction

    It can be modified. How do you want it too be modified. Add the other criteria in the After sheet?

  6. #6
    Forum Contributor
    Join Date
    03-14-2013
    Location
    FL
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: remove groups of rows that don't meet a qualifiction

    Quote Originally Posted by JOHN H. DAVIS View Post
    It can be modified. How do you want it too be modified. Add the other criteria in the After sheet?
    Can you modify it so that it doesn't remove the rows (other criteria) that are in the after sheet? For example all rows that have the code AUGELMIC should stay because somewhere AUGELMIC has both PAU and either HO3 or HO6(in this case AUGELMIC has both HO3 and HO6).

  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 groups of rows that don't meet a qualifiction

    That can be done. You need to restate your criteria for the rows not too delete. There are still many items contained in your After sheet that do not meet the criteria's you've previously stated.

  8. #8
    Forum Contributor
    Join Date
    03-14-2013
    Location
    FL
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: remove groups of rows that don't meet a qualifiction

    I'm looking to remove any code that does not have PAU coverage and either HO3 Coverage or HO6 coverage anywhere on that code. If the Code contains PAU and either HO3 or HO6 then all of that particular code should remain even if there is a coverage that does not match PAU HO3 or HO6.
    On the attached example i highlighted the groups that need to be deleted. The highlight sections for the groups only contain a key of 1 or 2 or neither. The groups that remain have both a 1 and 2 key.

    Let me know if I'm doing a bad job at explaining this.
    Attached Files Attached Files

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

    Re: remove groups of rows that don't meet a qualifiction

    I'm afraid I still don't understand your criteria based on your sample. The some of the highlighted cells have HO6, HO3, PAU, but then you're saying they should be deleted? However this will delete the rows which are highlighted. Hope that helps.

    Please Login or Register  to view this content.

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: remove groups of rows that don't meet a qualifiction

    You could put thie following formula in cell G2 and copy it down.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Then you can filter on column G for "keep" or "delete". It gives you the opportunity to sight check data. Note you have "DIPALMAR" on row 64 which perhaps should be "DIPOLMAR". Maybe safer than running code blind.

    That said, it would be easy enough to add that formula using code and do the filter, selection and deletion of rows.

    See the attached updated example.

    Regards, TMS
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    03-14-2013
    Location
    FL
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: remove groups of rows that don't meet a qualifiction

    Quote Originally Posted by JOHN H. DAVIS View Post
    I'm afraid I still don't understand your criteria based on your sample. The some of the highlighted cells have HO6, HO3, PAU, but then you're saying they should be deleted? However this will delete the rows which are highlighted. Hope that helps.
    Some of the highlights do have either PAU HO3 or HO6, that is correct. What i want to keep needs to have both PAU and HO3 or both PAU and HO6.
    123OLDYO gets deleted because it only has HO6
    AARONMAT gets deleted because it only has HO6
    ABADAMAR gets deleted because it only has HO3
    ABATEKAT does not get deleted because it has both PAU and HO3
    ABBOTCYN gets deleted because it onlyu has PAU
    All of AUGELMIC Stays because it has both PAU and HO3 it also has HO6... This would only be removed if AUGELMIC did not have HO3 and HO6or if it did not have PAU.

  12. #12
    Forum Contributor
    Join Date
    03-14-2013
    Location
    FL
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: remove groups of rows that don't meet a qualifiction

    Quote Originally Posted by TMS View Post
    You could put thie following formula in cell G2 and copy it down.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Regards, TMS
    This accomplishs what I need. Thanks for your help.

    Also Thanks to John for working with me and trying to get this figured out.

  13. #13
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: remove groups of rows that don't meet a qualifiction

    You're welcome.

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

    Re: remove groups of rows that don't meet a qualifiction

    You're welcome. Glad you got a solution.

+ 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. sum of rows that meet certain criteria
    By trqwrench in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-20-2014, 07:51 PM
  2. Rank sub groups of rows seperated with blank rows
    By peasther in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-28-2014, 05:52 PM
  3. [SOLVED] vba to remove rows that meet the contents from other worksheet
    By tantcu in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-13-2013, 05:35 PM
  4. [SOLVED] Unable to remove names on cell groups for use in drop down lists
    By Allsort in forum Excel General
    Replies: 1
    Last Post: 08-14-2013, 02:00 PM
  5. Replies: 3
    Last Post: 01-14-2013, 02:23 PM
  6. VBA- deleting rows which contain cells that meet criteria, but skip alpha rows
    By cheapkid1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-30-2012, 08:49 AM
  7. Counting Groups with Formula that meet a criteria
    By PCJasper in forum Excel General
    Replies: 13
    Last Post: 11-29-2011, 03:49 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