+ Reply to Thread
Results 1 to 14 of 14

How many rows can Excel handle to delete?

  1. #1
    Forum Contributor amartinez988's Avatar
    Join Date
    05-04-2015
    Location
    Miami
    MS-Off Ver
    Office 2010
    Posts
    183

    How many rows can Excel handle to delete?

    I'm filtering Data using VBA (of course) and I want to delete the visible Rows but they are more than 20K rows. Excel crashes trying to process the request and my question is:

    What's the limit of rows that Excel can delete at one time?
    Why does this happen?
    Is there any workaround that is not deleting the rows on chunks?

    Thank you all.
    1 Or 0, that is the question.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: How many rows can Excel handle to delete?

    Do the rows you're deleting contain formulae and if so how complex are they and how many of the columns contain formulae.

    Have you tried putting Excel into manual calculation mode?

    As an experiment try range valuing all the data to remove the formulae and then perform the filter and deletion. Does that speed things up?
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor amartinez988's Avatar
    Join Date
    05-04-2015
    Location
    Miami
    MS-Off Ver
    Office 2010
    Posts
    183

    Re: How many rows can Excel handle to delete?

    I have no Formulas, just regular Data. It actually finished deleting the rows after a couple of mins (5-10 mins). However, If I want to delete more than that I will take like half of an hour....

    I was wondering if there's a workaround or a faster way to it. I considered setting calculation to Manual.

    Thanks,

  4. #4
    Forum Contributor
    Join Date
    08-09-2012
    Location
    British Columbia
    MS-Off Ver
    Excel 2010
    Posts
    190

    Re: How many rows can Excel handle to delete?

    I think xladept's approach in the discussion here will be of interest to you.

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: How many rows can Excel handle to delete?

    Any chance you could upload the workbook, anonymised if necessary.

    When you say you're using VBA to filter the rows do you mean that you're using a loop to process each row in turn by any chance? If so that would be exceedingly slow and I wouldn't be surprised.

  6. #6
    Forum Contributor amartinez988's Avatar
    Join Date
    05-04-2015
    Location
    Miami
    MS-Off Ver
    Office 2010
    Posts
    183

    Re: How many rows can Excel handle to delete?

    When you say you're using VBA to filter the rows do you mean that you're using a loop to process each row in turn by any chance? If so that would be exceedingly slow and I wouldn't be surprised.
    Nope I'm literally Filtering the Data. Here's the code:

    Please Login or Register  to view this content.

  7. #7
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: How many rows can Excel handle to delete?

    Try it without the Shift:=xlup which as far as I can see is redundant if you're deleting the row.

  8. #8
    Forum Contributor amartinez988's Avatar
    Join Date
    05-04-2015
    Location
    Miami
    MS-Off Ver
    Office 2010
    Posts
    183

    Re: How many rows can Excel handle to delete?

    Yeap, I already tried that. I left it because it makes no difference from a performance perspective and gives more readability to the code. I always like to specify the Default property like in Range("A1").Value. Value is not really necessary but it provides meaning to the code.

    However, that option to delete thousands of rows is very slow

  9. #9
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: How many rows can Excel handle to delete?

    rData.AutoFilter 5, "Bikes"
    Try first to sort your table for the 5th column, and then run your code

  10. #10
    Forum Contributor amartinez988's Avatar
    Join Date
    05-04-2015
    Location
    Miami
    MS-Off Ver
    Office 2010
    Posts
    183

    Re: How many rows can Excel handle to delete?

    Try first to sort your table for the 5th column, and then run your code

    I LIKE THAT IDEA!!!!

    Any suggestion on how to sort everything back to the previous state?

    Thanks,

  11. #11
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: How many rows can Excel handle to delete?

    Quote Originally Posted by amartinez988 View Post
    I LIKE THAT IDEA!!!!

    Any suggestion on how to sort everything back to the previous state?

    Thanks,
    Before you sort it introduce a helper column that is numbered 1,2,3....20000+

    After you've sorted it, sort again by the helper column.
    Has the sorting speeded things up?

    If not would you upload the workbook - anonymised as necessary so we can take a look.

  12. #12
    Forum Contributor amartinez988's Avatar
    Join Date
    05-04-2015
    Location
    Miami
    MS-Off Ver
    Office 2010
    Posts
    183

    Re: How many rows can Excel handle to delete?

    Before you sort it introduce a helper column that is numbered 1,2,3....20000+

    After you've sorted it sort again by the helper column.
    Has the sorting speeded things up?

    If not would you upload the workbook - anonymised as necessary so we can take a look.
    Perfect, I like the solution.

    I will let you guys know if I see any improvements.

    Thank you

  13. #13
    Forum Contributor amartinez988's Avatar
    Join Date
    05-04-2015
    Location
    Miami
    MS-Off Ver
    Office 2010
    Posts
    183

    Re: How many rows can Excel handle to delete?

    Problem solve!!!!

    Thank you both for taking the time. Here's the result:

    Deleting 25K ROWS
    When deleting in sort order: 1S
    When deleting without sort: 10-15 mins

    Winner: Sort, then delete.

    Thank you both again.

  14. #14
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: How many rows can Excel handle to delete?

    Did you try setting calculation to manual and/or disabling events?
    If posting code please use code tags, see here.

+ 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. [SOLVED] Getting fill handle to recognise a gap in the rows
    By OwenMcH in forum Excel General
    Replies: 7
    Last Post: 08-02-2014, 12:28 PM
  2. Macro To Find Rows With Duplicates, Compare Cells, And Delete Rows. - Excel
    By Kwame001 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-26-2013, 10:41 AM
  3. Drag handle - link rows to columns
    By mpfsfood in forum Excel General
    Replies: 2
    Last Post: 07-16-2009, 06:44 PM
  4. Replies: 2
    Last Post: 05-19-2006, 06:35 PM
  5. handle data with too many rows
    By hurriance in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 01-27-2006, 12:10 PM
  6. Excel should handle more than 65,536 rows.
    By colekp in forum Excel General
    Replies: 2
    Last Post: 09-26-2005, 11:05 AM
  7. To many rows for EXCEL to handle
    By moglione1 in forum Excel General
    Replies: 3
    Last Post: 09-09-2005, 10: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