Search code examples
google-sheetsgoogle-sheets-formulasumifs

SUMIFS FUNCTION not functioning as expected


What's the reason this array formula (in cell H1) is not producing the indented result of showing the total revenue per month?

={"Total Revenue";ARRAYFORMULA(if(G2:G<>"",sumifs(D2:D,C2:C,G2:G,B2:B,">0"),))}

enter image description here

I tried changing the syntax of the formula as per solution I found on another site to no avail.

={"Total Revenue";ARRAYFORMULA(if(G2:G<>"",sumif(C2:C&B2:B,G2:G&">0",D2:D),))}

Solution

  • SUMIFS is already an arrayformula, that's why it won't be able to detect exactly what you're trying to do, which values to consider as individual each row. You can use BYROW taking the values of months as input each time:

    ={"Total Revenue";BYROW(G2:G,LAMBDA(each,if(each<>"",sumifs(D2:D,C2:C,each,B2:B,">0"),)))}