+ Reply to Thread
Results 1 to 6 of 6

Deleting a set of entries based on sum of entries in the set

  1. #1
    Registered User
    Join Date
    07-20-2019
    Location
    Europe
    MS-Off Ver
    2016
    Posts
    26

    Deleting a set of entries based on sum of entries in the set

    Hi,

    I have a table that has columns date, code and amount. There are many other columns but they are irrelevant. Each line in this table belongs to a group. Each group has a code in the corresponding column. That is, each line has own date and amount, but the code is the same for the group. I would like to delete all the groups of lines if the sum of their amount equals to zero. How can that be done?
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,705

    Re: Deleting a set of entries based on sum of entries in the set

    I have used Power Query, called Get and Transform Data in your version of Excel and found on the Data Tab.

    I loaded your table into the PQ editor. Data-->Get & Transform Data-->From Table or Range

    I then applied the following Mcode
    Please Login or Register  to view this content.
    I then made a duplicate of the original table in PQ and created a merge of each table to the other (a left outer join)

    Here is the Mcode for that next section

    Please Login or Register  to view this content.
    Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

    It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

    - Follow this link to learn how to install Power Query in Excel 2010 / 2013.

    - Follow this link for an introduction to Power Query functionality.

    - Follow this link for a video which demonstrates how to use Power Query code provided.
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Deleting a set of entries based on sum of entries in the set

    regn,
    What's happen to your previous thread.
    https://www.excelforum.com/excel-pro...ntire-set.html

    vba
    Please Login or Register  to view this content.
    Last edited by jindon; 08-15-2021 at 09:29 AM.

  4. #4
    Registered User
    Join Date
    07-20-2019
    Location
    Europe
    MS-Off Ver
    2016
    Posts
    26

    Re: Deleting a set of entries based on sum of entries in the set

    Thanks for the hint! Yes, I thought this could be done with PQ. There are actually many ways to accoplish this, the easiest one is probably is through SUMIFS funciton. You can just insert this function in each line (with the code as criteria) and delete all the rows that return 0. I'm just learning VBA, and this is why I wonder how this can be done with more advanced code.
    Last edited by alansidman; 08-15-2021 at 12:19 PM.

  5. #5
    Registered User
    Join Date
    07-20-2019
    Location
    Europe
    MS-Off Ver
    2016
    Posts
    26

    Re: Deleting a set of entries based on sum of entries in the set

    @Jindon

    The requirements were a little bit different this time, so I created a new thread.

    Thanks again! This works!
    Last edited by alansidman; 08-15-2021 at 12:19 PM.

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,705

    Re: Deleting a set of entries based on sum of entries in the set

    Please don't quote whole posts -- it's just clutter.*If you are responding to a post out of sequence, limit quoted content to a few relevant lines that makes clear to whom and what you are responding. I have removed the quotes this time.

+ 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 a set of entries based on condition applied to the entire set
    By regn in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-31-2021, 03:37 PM
  2. Replies: 1
    Last Post: 11-27-2017, 08:50 PM
  3. Excel VBA: deleting entries based on date ranges
    By MattWardlow in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-15-2017, 12:17 PM
  4. [SOLVED] Read entries-locate entries and print entries
    By akotronis in forum Excel General
    Replies: 4
    Last Post: 05-01-2012, 03:05 PM
  5. Finding and Deleting Rows based on Formula entries
    By BehrBrew in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-27-2012, 06:01 PM
  6. Auto-Generating Entries based on combined Entries
    By Ice Burn in forum Excel General
    Replies: 3
    Last Post: 09-12-2011, 05:52 AM
  7. deleting many entries
    By a2zedgifts in forum Excel General
    Replies: 0
    Last Post: 01-17-2005, 12:26 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