+ Reply to Thread
Results 1 to 4 of 4

Deleting blocks of rows (same first column entry) according to multiple criteria using VBA

  1. #1
    Registered User
    Join Date
    08-11-2018
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    2

    Deleting blocks of rows (same first column entry) according to multiple criteria using VBA

    I have the following data and the desired outcome, see below. I have about 100,000 entries. I will a loop with VBA that does the following:


    • If a company contains in column 2 either of the following PE, M&A, Debt (these are actually many more, I have a list of what to exclude), then delete all rows of that company
    • If a company's column 2 entries do not contain any PE, M&A, Debt, then do not delete this company from the list
    • E.g.:
    o Company 1 contains a PE, M&A deal --- hence all 5 rows of Company 1 need to be deleted
    o Company 2 does not contain any of PE, M&A, Debt deals --- hence keep all rows of Company 2

    Data:

    Name | Deal

    Company 1 PE
    Company 1 M&A
    Company 1 Seed
    Company 1 Seed
    Company 1 Angel
    Company 2 Seed
    Company 2 -
    Company 2 Seed
    Company 3 Debt
    Company 4 Angel
    Company 4 -
    Company 4 Angel
    Company 4 Seed
    … ….
    … ….

    Outcome:

    Name | Deal

    Company 2 Seed
    Company 2 -
    Company 2 Seed
    Company 4 Angel
    Company 4 -
    Company 4 Angel
    Company 4 Seed
    … ….
    … ….



    Thanks a lot for your help!

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Deleting blocks of rows (same first column entry) according to multiple criteria using

    This is easily done using two helper columns

    In one column use multiple If functions to look for one of your flags if found then return company name

    In a second column, flag all company names that appear in the first helper column

    Sort and delete.



    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Last edited by mehmetcik; 08-11-2018 at 01:44 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    08-11-2018
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    2

    Re: Deleting blocks of rows (same first column entry) according to multiple criteria using

    Hi mehmetcik,

    thanks for your reply.

    I need to do it via VBA though, not with helper columns.

    How do I attach a sample workbook?

    Thanks.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,053

    Re: Deleting blocks of rows (same first column entry) according to multiple criteria using

    Welcome to the forum

    Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    Please make sure to include the full link, so that other members will be permitted to continue helping you

    Note that if you have fewer than 10 posts, you may need to type the link, or past it in pieces (or ask a mod to do that for you)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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. Deleting rows, multiple column criteria
    By Lift Off in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-24-2014, 09:40 PM
  2. [SOLVED] Deleting rows using Autofilter with multiple <> criteria
    By {=OR(value=array)} in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-15-2014, 02:10 PM
  3. Fill an incremental time entry in blocks of 4 rows
    By suedavies in forum Excel General
    Replies: 4
    Last Post: 04-08-2014, 04:01 PM
  4. [SOLVED] Deleting rows by column data with various criteria (complex)
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-28-2013, 07:58 PM
  5. [SOLVED] Deleting rows based on multiple criteria
    By weldo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-02-2012, 08:02 AM
  6. Deleting all rows that don't fit criteria range in a column
    By oenleunc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-04-2012, 07:39 PM
  7. Deleting rows, Multiple criteria
    By Wedge120 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-29-2011, 10:51 PM

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