+ Reply to Thread
Results 1 to 8 of 8

Combining Two SUMIFS

  1. #1
    Valued Forum Contributor
    Join Date
    10-10-2012
    Location
    New York
    MS-Off Ver
    Excel 2007/2010
    Posts
    337

    Combining Two SUMIFS

    I have this fun formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    and was wondering if there is a way to combine the part of it that says
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    into one SUMIFS formula?

    Nothing critical, as the formula works as-is, just curious.
    Don't just use the answers provided for you. Try to understand how it works by reverse engineering or asking about it.

    Please mark the thread as [SOLVED] (Thread Tools->Mark thread as Solved) when answered.
    If you're happy with an answer given, please click the * under the person's name to boost their reputation.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,621

    Re: Combining Two SUMIFS

    Perhaps
    Please Login or Register  to view this content.
    ?

  3. #3
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Combining Two SUMIFS

    Try replacing that part with

    SUMPRODUCT((Data!$G:$G=E$6)*Data!$J:$K)

  4. #4
    Valued Forum Contributor
    Join Date
    10-10-2012
    Location
    New York
    MS-Off Ver
    Excel 2007/2010
    Posts
    337

    Re: Combining Two SUMIFS

    Neither of those are working for me. Thanks for your input though.

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Combining Two SUMIFS

    First let me just say....
    "If it ain't broke, don't fix it"
    and
    "Shorter does not = Better"


    Anyway, that said..
    Quote Originally Posted by Craig K. View Post
    Neither of those are working for me. Thanks for your input though.
    In what way does it not work?
    Do you get an error? What error?
    Does it not give the correct result? What result DID it give? What result did you expect, and why?


    Assuming this works
    =IFERROR(SUMIFS(Data!$AM:$AM,Data!$G:$G,E$6)/(SUMIFS(Data!$J:$J,Data!$G:$G,E$6)+SUMIFS(Data!$K:$K,Data!$G:$G,E$6)),0)
    Strip of the Iferror just to make it simpler for now
    =SUMIFS(Data!$AM:$AM,Data!$G:$G,E$6)/(SUMIFS(Data!$J:$J,Data!$G:$G,E$6)+SUMIFS(Data!$K:$K,Data!$G:$G,E$6))

    You want to replace the part AFTER the / with something that combines those 2 parts into 1 right?
    (SUMIFS(Data!$J:$J,Data!$G:$G,E$6)+SUMIFS(Data!$K:$K,Data!$G:$G,E$6))

    This should accomplish the same thing
    SUMPRODUCT((Data!$G:$G=E$6)*Data!$J:$K)

    So
    =SUMIFS(Data!$AM:$AM,Data!$G:$G,E$6)/(SUMIFS(Data!$J:$J,Data!$G:$G,E$6)+SUMIFS(Data!$K:$K,Data!$G:$G,E$6))
    becomes
    =SUMIFS(Data!$AM:$AM,Data!$G:$G,E$6)/SUMPRODUCT((Data!$G:$G=E$6)*Data!$J:$K)

    Put the IFERROR part back in

    =IFERROR(SUMIFS(Data!$AM:$AM,Data!$G:$G,E$6)/SUMPRODUCT((Data!$G:$G=E$6)*Data!$J:$K),0)

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Combining Two SUMIFS

    A possible reason for this to not work is if there are NON numeric values in column J or K
    Sumif can handle that, sumproduct can't.

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,721

    Re: Combining Two SUMIFS

    You could revert to an "array formula", i.e. this version

    =IFERROR(SUMIFS(Data!$AM:$AM,Data!$G:$G,E$6)/SUM(IF(Data!$G:$G=E$6,Data!$J:$K)),0)

    confirmed with CTRL+SHIFT+ENTER

    That will allow non-numeric values in Data columns J and K......

    ......but it may be better to stick with your original as SUMIFS or SUMIF is generally more efficient
    Audere est facere

  8. #8
    Valued Forum Contributor
    Join Date
    10-10-2012
    Location
    New York
    MS-Off Ver
    Excel 2007/2010
    Posts
    337

    Re: Combining Two SUMIFS

    Quote Originally Posted by Jonmo1 View Post
    A possible reason for this to not work is if there are NON numeric values in column J or K
    Sumif can handle that, sumproduct can't.
    You're right, I have column headers. I adjusted the formula you had to SUMPRODUCT((Data!$G2:$G1000=E$6)*Data!$J2:$K1000) and it worked. Bad etiquette on my part for not explaining what was happening when it didn't work. Cheers!


    @longlegs - In general I try to stay away from array formulas because I don't who I'm going to be handing my spreadsheets off to. Also, if I revisit an old spreadsheet I made and there are array formulas, I probably won't notice the {} signifying it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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