+ Reply to Thread
Results 1 to 7 of 7

Macro to delete rows based on multiple criteria

  1. #1
    Registered User
    Join Date
    06-26-2012
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    37

    Macro to delete rows based on multiple criteria

    Hi

    A macro is required to identify rows within a selection e.g. entire column A, that share the same value, then delete appropriate rows depending on the values in another column. The attached example details the requirements.

    If anybody can help that would be great.

    Extract Rec1.xlsx

    Thanks
    Last edited by Andrew E Smith; 07-12-2014 at 12:19 PM.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Macro to delete rows based on multiple criteria

    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    06-26-2012
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    37

    Re: Macro to delete rows based on multiple criteria

    Thanks for your reply. The formula works well on the sample I provided. However, on the actual file (which has over 3000 rows), the formula returns multiple rows for some of the Internal ID's.

    The attachment below is the actual report (with all data randomised for confidentiality) to give it some scale.

    EHF Masterfile.xlsx

    I've also simplified the requirement as follows (so macro may need to be tweaked accordingly):

    - The macro should return 1 row per internal ID with the most recent timestamp

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

    Re: Macro to delete rows based on multiple criteria

    Hi Andrew,

    No VBA needed if you add a helper column and use an Advanced Filter. See the attached.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  5. #5
    Registered User
    Join Date
    06-26-2012
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    37

    Re: Macro to delete rows based on multiple criteria

    Hi Marvin

    Thanks for taking time to look at this for me. I've done a couple of spot checks on the data in Q-T and I don't think its working as required as the latest timestamp is not showing e.g. 9002880 should be showing the 11th April but is showing 9th Jan.

    Also hoping for something less manual i.e. a macro i can link to a button. Is this possible?

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to delete rows based on multiple criteria

    Hi Andrew,
    Try the attached.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    06-26-2012
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    37

    Re: Macro to delete rows based on multiple criteria

    That is absolutely spot on sir. Thank you so much.

    All the best. Andrew

+ 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. Delete Multiple Rows based on Criteria
    By athyeh in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 06-20-2013, 03:13 PM
  2. macro - delete rows based on multiple criteria.
    By ChocksterNo1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-05-2013, 10:22 AM
  3. [SOLVED] Delete Rows based on Multiple Name Criteria
    By Graham Taylor in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-14-2012, 09:11 AM
  4. Delete rows based on multiple criteria
    By ohkking in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-18-2011, 11:30 AM
  5. Delete rows based on multiple criteria
    By couger77 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-17-2007, 03:29 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