+ Reply to Thread
Results 1 to 6 of 6

Macro to filter data by category and delete rows where category sums up to zero

  1. #1
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    1,936

    Macro to filter data by category and delete rows where category sums up to zero

    i have various categories in Col P

    I would like a macro to filter Col I by category and where the values in Col h sum to zero for a particular category to delete all the rows for that category


    It would be appreciated if someone would provide me with the code to do this

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,989

    Re: Macro to filter data by category and delete rows where category sums up to zero

    I would suggest moving the list of categories from column P to column A of another sheet, naming that sheet as "Categories". The reason for this is that some of the rows which contain the categories in column P may be deleted by the macro if left in the sheet containing the data. Try this macro and change the sheet names (in red) to suit your needs.
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    1,936

    Re: Macro to filter data by category and delete rows where category sums up to zero

    Thank for the help Mumps1

    The Macro is not deleting the rows pertaining to the categories that sums to zero

    I have attached the original workbook with a sheet called "result" to show what the result should be.

    i have also attached a workbook showing what the result looks like after running the macro

    Kindly test and amend your code

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,989

    Re: Macro to filter data by category and delete rows where category sums up to zero

    Try:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    1,936

    Re: Macro to filter data by category and delete rows where category sums up to zero

    Many Thanks Mumps1

    You revised code works perfectly

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,989

    Re: Macro to filter data by category and delete rows where category sums up to zero

    My pleasure.

+ 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: 1
    Last Post: 11-24-2020, 10:44 AM
  2. Replies: 0
    Last Post: 04-09-2014, 04:21 PM
  3. Filtering by text
    By saltarazan in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-16-2013, 04:18 AM
  4. Replies: 2
    Last Post: 09-14-2012, 04:31 AM
  5. Replies: 3
    Last Post: 07-27-2012, 03:01 PM
  6. [SOLVED] Productsum: Highest Frequency Category, Specific Main Category, Frequency of Category
    By T86157 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-24-2012, 12:43 PM
  7. Single field fits fault category, event category determined by group of faults
    By SchoobsVT in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-07-2010, 08:51 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