+ Reply to Thread
Results 1 to 4 of 4

Quickest way to remove rows where sum or certain columns = 0

  1. #1
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Quickest way to remove rows where sum or certain columns = 0

    Hi all,

    I have a sheet with 800K rows, most of which are somewhat pointless.
    Each row has data in columns A:X, but I want to keep only the rows where the sum of columns E:O isn’t zero.

    I do this in a for loop like below, but it’s really slow. How can I make this quicker?

    Please Login or Register  to view this content.
    Obviously I turn off events, calculation and screenupdating.

    Any better way to do this?

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Quickest way to remove rows where sum or certain columns = 0

    Try using Autofilter to select the rows you want to delete, and then delete the visible cells.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Quickest way to remove rows where sum or certain columns = 0

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Quickest way to remove rows where sum or certain columns = 0

    Sorry, I forgot to say that I used the 'delete empty rows' method, but it still took up to 30seconds or so, which is too slow.
    I finally solved it using an array, which takes 4 seconds:

    (AA contains my 800K row text file loaded in as array)

    Please Login or Register  to view this content.

+ 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. Quickest way to sum certain rows
    By JasperD in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-19-2019, 03:19 PM
  2. Replies: 3
    Last Post: 12-21-2016, 12:14 PM
  3. Remove blank rows and columns
    By horsefish01 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 02-28-2016, 04:18 PM
  4. Remove 0 in PT for rows AND columns
    By Elorac in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 04-27-2015, 06:37 AM
  5. Remove Rows and Columns from 2-D array
    By danman2tall in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-22-2013, 01:51 PM
  6. excel macro to remove specific columns and rows + remove duplicate
    By garrywelson in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-17-2013, 12:03 PM
  7. What is the quickest way to hide a lot of rows and colums ?
    By Stephen Tyrrell in forum Excel General
    Replies: 2
    Last Post: 08-19-2005, 04:05 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