英文:
SUMIFS FUNCTION not functioning as expected
问题
这个数组公式(在单元格 H1 中)未能产生按月份显示总收入的缩进结果的原因是什么?
={"总收入";ARRAYFORMULA(if(G2:G<>"",sumifs(D2:D,C2:C,G2:G,B2:B,">0"),))}
我尝试根据另一个网站上找到的解决方案更改了公式的语法,但没有成功。
={"总收入";ARRAYFORMULA(if(G2:G<>"",sumif(C2:C&B2:B,G2:G&">0",D2:D),))}
英文:
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"),))}
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),))}
答案1
得分: 2
SUMIFS已经是一个数组公式,这就是为什么它无法准确检测你正在尝试做什么,哪些值应该被视为每行的个体。你可以使用BYROW,每次将月份的值作为输入:
={"总收入";BYROW(G2:G, LAMBDA(each, IF(each<>"", SUMIFS(D2:D, C2:C, each, B2:B, ">0"), )))}
英文:
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"),)))}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论