+ Reply to Thread
Results 1 to 19 of 19

Alternative to SUMIF

  1. #1
    Registered User
    Join Date
    05-26-2017
    Location
    Burnsville, MN
    MS-Off Ver
    2016
    Posts
    50

    Alternative to SUMIF

    How can I create this calculation without SUMIF? Currently I have about 30,000 rows, each row has an associated "Inventoryid" (columnQ). Each "Inventoryid" shows up 3 times (once per fiscal month, 3 months of data). If I use SUMIF my workbook becomes practically unusable due to all the resources needed to recalculate that much data.

    Another helper column to get there would be great, I'm data stumped. Thanks for your help!

    Here is a snip of what I'm trying to do.

    Capture.PNG

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Alternative to SUMIF

    What's the SUMIF formula you are currently using? It's much easier to help if you provide a sample workbook.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Valued Forum Contributor spitfireblue's Avatar
    Join Date
    01-29-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2007,2010,2016
    Posts
    611

    Re: Alternative to SUMIF

    Is your data always sorted by inventoryid?
    Regards,
    Stephen

    If you feel someone has helped you please thank them and click on the star on their post to add reputation.
    Please ensure that you use code tags where relevant, and mark solved threads as solved.
    Most of all please be respectful and understanding of others.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Alternative to SUMIF

    No real shortcut to what you, that I can think of.

    If your data is already sorted, and wont be added to, you could maybe convert the sumif formulas using copy/paste values

    Can you show a sample of your formula?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Alternative to SUMIF

    If you are OK to use VBA: this SUMs every 3 rows i.e. assumes data sorted by Inventory ID

    Attached file has 30000 rows.

    Please Login or Register  to view this content.
    You may need to change column references (currently B for Data, C for Output
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    05-26-2017
    Location
    Burnsville, MN
    MS-Off Ver
    2016
    Posts
    50

    Re: Alternative to SUMIF

    The VBA was working great until I discovered about 3000 rows down that I do not have exactly 3 matching inventoryid for every instance. So unfortunately sorting by inventoryid and summing every 3 does not work. It will eventually become misaligned.

    Ultimately here is what happened about 3000 rows down

    Capture.PNG

    SUMIF would work perfect to only sum matching inventoryid if it didn't slow my workbook down.

    Here is the SUMIF I tried to use

    =SUMIF($Q$3:$Q$30000,Q3,$C$3:$C$30000)

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Alternative to SUMIF

    Try this : modified VBA

    Please Login or Register  to view this content.
    Last edited by JohnTopley; 06-05-2018 at 03:40 PM.

  8. #8
    Valued Forum Contributor spitfireblue's Avatar
    Join Date
    01-29-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2007,2010,2016
    Posts
    611

    Re: Alternative to SUMIF

    Or you could just try
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Alternative to SUMIF

    @ spitfireblue, OP is trying to avoid using SUMIF because it slows their file down

  10. #10
    Valued Forum Contributor spitfireblue's Avatar
    Join Date
    01-29-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2007,2010,2016
    Posts
    611

    Re: Alternative to SUMIF

    @FDibbens - true but calculating a SUMIF on 5 rows of data will be a lot quicker than on 30,000 rows of data, especially when you are doing it 30,000 times

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Alternative to SUMIF

    Why 5 rows ?????

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Alternative to SUMIF

    I was wondering that too, John?

  13. #13
    Valued Forum Contributor spitfireblue's Avatar
    Join Date
    01-29-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2007,2010,2016
    Posts
    611

    Re: Alternative to SUMIF

    @JohnTopley @FDibbins
    I believe that each inventoryid shows up a maximum of 3 times and that the sheet is sorted by inventoryid based on the information that we have been given. Therefore my formula in row 3 will pick up the duplicate inventoryids in rows 3-5 (and ignore 1 and 2), then in row 4 will pick up the duplicate inventoryids in rows 3-5 (and ignore 2 and 6) etc.
    Maybe I am missing something?!?

  14. #14
    Registered User
    Join Date
    05-26-2017
    Location
    Burnsville, MN
    MS-Off Ver
    2016
    Posts
    50

    Re: Alternative to SUMIF

    Great suggestions from everyone, thanks so much for the help. @Spitfireblue you were right on! I reduced the number of calculations significantly and that cleared up the bottle neck. I used your suggested formula on 3 different columns 30,000 times each and it worked great.

  15. #15
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Alternative to SUMIF

    I tried the formula (iF i Have it right) but did not get the right results:
    Attached Files Attached Files

  16. #16
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Alternative to SUMIF

    Even starting in row 3 (which I think is what is needed), it only works for consistent blocks of 3.

  17. #17
    Valued Forum Contributor spitfireblue's Avatar
    Join Date
    01-29-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2007,2010,2016
    Posts
    611

    Re: Alternative to SUMIF

    @JohnTopley Yes it only works for consistent blocks of 3, but that is all that was needed in this particular case. It's not a perfect solution but sometimes the simple solution is all that is needed.

  18. #18
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Alternative to SUMIF

    The reason I changed the VBA was because the OP said
    I do not have exactly 3 matching inventoryid for every instance.
    .

    So I cannot see how he states the formula is OK in his particular case; I agree with your logic for a consistent set of 3s- very inventive

  19. #19
    Valued Forum Contributor spitfireblue's Avatar
    Join Date
    01-29-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2007,2010,2016
    Posts
    611

    Re: Alternative to SUMIF

    Because my logic also works on sets of 2 and for individual ids.
    My assumptions based on the information we had been given were that there was a maximum of 3 matching ids and the ids were sorted.

+ 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: 2
    Last Post: 03-15-2012, 05:22 AM
  2. Need an Alternative to SumIF
    By caliskier in forum Excel General
    Replies: 4
    Last Post: 02-22-2012, 01:32 PM
  3. Alternative to SUMIF
    By ltmaiyk in forum Excel General
    Replies: 2
    Last Post: 01-22-2010, 12:06 AM
  4. SUMIF Alternative
    By rwall in forum Excel General
    Replies: 1
    Last Post: 04-05-2009, 07:21 PM
  5. =SUMIF() problem/alternative
    By grant606 in forum Excel General
    Replies: 3
    Last Post: 11-30-2007, 01:58 PM
  6. [SOLVED] alternative function to sumif
    By Rich in forum Excel General
    Replies: 1
    Last Post: 12-16-2005, 05:25 AM
  7. SUMIF Alternative?
    By qflyer in forum Excel Formulas & Functions
    Replies: 22
    Last Post: 09-06-2005, 10:05 AM
  8. SUMIF Alternative?
    By qflyer in forum Excel General
    Replies: 1
    Last Post: 06-20-2005, 02: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