+ Reply to Thread
Results 1 to 8 of 8

Application.SumIfs with specialcells (filtered rows)

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

    Application.SumIfs with specialcells (filtered rows)

    Hi guys,

    I set a range with values as follows
    Please Login or Register  to view this content.
    and that works fine

    If I do this - I get the result as expected :
    Please Login or Register  to view this content.
    however, I want to add another criteria, so I try to do this :
    Please Login or Register  to view this content.
    This gives me a #VALUE in cell E1 and I can't figure out why...

    Can anyone please point me in the right direction? I want to avoid looping through the visible rows to keep things speedy :-)
    Thanks in advance for any reply!
    Please click the * below if this helps

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

    Re: Application.SumIfs with specialcells (filtered rows)

    If you're filtering, why don't you set the filter on column F for "Pear"?
    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.

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

    Re: Application.SumIfs with specialcells (filtered rows)

    Hi AlphaFrog!

    To be honest, that's what I'm doing now - I loop through the different filter criteria and then use SUBTOTAL(109) to count the totals.
    However, this is rather slow and I was hoping that there's a way to use SUMIFs with filtered rows.
    So far I haven't been able to find a way though, but I really hope I'll be able to find something, cause this is getting annoying :-)

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

    Re: Application.SumIfs with specialcells (filtered rows)

    Quote Originally Posted by JasperD View Post
    Hi AlphaFrog!

    To be honest, that's what I'm doing now - I loop through the different filter criteria and then use SUBTOTAL(109) to count the totals.
    However, this is rather slow and I was hoping that there's a way to use SUMIFs with filtered rows.
    So far I haven't been able to find a way though, but I really hope I'll be able to find something, cause this is getting annoying :-)

    Can you show your whole macro?

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

    Re: Application.SumIfs with specialcells (filtered rows)

    The slow part :

    Please Login or Register  to view this content.
    It loops this part 17 times, but in the end, it will loop it about 80 times
    Working with Application.Subtotal doesn't make it any quicker

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

    Re: Application.SumIfs with specialcells (filtered rows)

    I retract my first comment, using Application.Subtotal(109, .Range(weekcll & "8:" & weekcll & x)) does make it slightly quicker, so I used that instead.

    One of the reasons I can think of that might help make it quicker is that I now use x as the last row when the data is not filtered, which is about 32.000
    However, I think the filtered data is only a couple of hundred rows each time - is there a way to set x as the last row of FILTERED data?

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

    Re: Application.SumIfs with specialcells (filtered rows)

    That's not the whole code; that's still only part of it. I'm sure you're trying help by keeping things simple, but it would help greatly to be able to see everything; the whole procedure.

    I'll bet the real speed bottleneck is not the SUMIFS versus SUBTOTAL function or the last visible cell. So better yet, if you could post an example workbook with data and the entire macro and a sheet with has the expected results and a brief description of what you're doing, I'd be happy to look at where it may be optimized.

    If you still just want to do it piecemeal then...
    Last used visible row in column weekcol
    x = Cells(Rows.Count, weekcol).End(xlUp).Row
    I doubt you'll see much speed increase if any with just that change though.

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

    Re: Application.SumIfs with specialcells (filtered rows)

    Hi Alphafrog,

    The whole code spans three or four routines and is quite long.
    I know this part is making it slow though, cause if I skip it, the data shows up in a jiffy - if I leave it, the data takes ~2 seconds longer to run...
    I will see if I can make a workbook with the confidential data removed, but still populated with 30k + rows
    In the mean time, I've described my challenge in more depth here : http://www.excelforum.com/excel-prog...nal-array.html
    Please have a look if you're not too busy.

    Thanks so much!

+ 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] Using sumifs for a filtered range
    By liranbo in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-01-2012, 12:09 PM
  2. sumifs and filtered data
    By finance14 in forum Excel General
    Replies: 3
    Last Post: 12-22-2011, 11:36 AM
  3. SumIFS() filtered by the month of a date cell
    By truecrisis in forum Excel General
    Replies: 2
    Last Post: 07-06-2010, 07:57 AM
  4. Deleting blank rows using loop and SpecialCells
    By SOS in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-05-2008, 09:40 AM
  5. Using SpecialCells to return rows for deletion
    By Philip in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-21-2005, 11: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