英文:
Sum Columns based on Column Header in a SUMIFS formula
问题
我正在尝试创建一个仪表板。
=IF(AND(Dashboard!G11="All", Dashboard!G18<>"All"), SUMIFS(INDEX(dtPages!C2:R,0,MATCH(Dashboard!G18,dtPages!C1:R1,0)), dtPages!T:T,Dashboard!X11,dtPages!U:U,Dashboard!X13), "某些东西")
这个公式应该根据一些额外的条件,对一个列进行SUMIFS,其标题等于单元格Dashboard!G18。
我收到了一个"SUMIFS的数组参数大小不同"的错误。我理解这个错误的含义,我怀疑是这个导致了这个错误:
INDEX(dtPages!C2:R,0,MATCH(Dashboard!G18,dtPages!C1:R1,0))
这应该是这个公式的一部分(我假设你可以省略"SUM("部分,因为SUMIFS应该计算SUM。
SUM(INDEX(dtPages!C2:R,0,MATCH(Dashboard!G18,dtPages!C1:R1,0)))
有谁能帮忙吗?
我还尝试过:
=IF(AND(Dashboard!G11="All", Dashboard!G18<>"All"), SUMIFS(SUMPRODUCT((dtPages!C2:R)*(dtPages!C1:R1=Dashboard!G18)), dtPages!T:T,Dashboard!X11,dtPages!U:U,Dashboard!X13), "错误")
使用
SUMPRODUCT((dtPages!C2:R)*(dtPages!C1:R1=Dashboard!G18))
代替上面的INDEX公式。但我得到了一个"参数必须是一个范围"的错误。
英文:
I'm trying to create a dashboard.
=IF(AND(Dashboard!G11="All", Dashboard!G18<>"All"), SUMIFS(INDEX(dtPages!C2:R,0,MATCH(Dashboard!G18,dtPages!C1:R1,0)), dtPages!T:T,Dashboard!X11,dtPages!U:U,Dashboard!X13), "SOMETHING")
This formula is supposed to SUMIFS a column whose header is equal to cell Dashboard!G18 based on some extra criteria.
I get an "Array arguments to SUMIFS are of different size" error. I understand what the error means, and I suspect that it's this that's causing it:
INDEX(dtPages!C2:R,0,MATCH(Dashboard!G18,dtPages!C1:R1,0))
Which is supposed to be part of this formula (I assumed that you can leave out the "SUM(" part, given that the SUMIFS should calculate the SUM.
SUM(INDEX(dtPages!C2:R,0,MATCH(Dashboard!G18,dtPages!C1:R1,0)))
Can anyone help?
I've also tried:
=IF(AND(Dashboard!G11="All", Dashboard!G18<>"All"), SUMIFS(SUMPRODUCT((dtPages!C2:R)*(dtPages!C1:R1=Dashboard!G18)), dtPages!T:T,Dashboard!X11,dtPages!U:U,Dashboard!X13), "ERROR")
By using
SUMPRODUCT((dtPages!C2:R)*(dtPages!C1:R1=Dashboard!G18))
Instead of the INDEX formula above. But I get an "Argument must be a range" error.
答案1
得分: 2
=IF(AND(Dashboard!G11="全部", Dashboard!G18<>"全部"), SUMIFS(INDEX(dtPages!C:R,0,MATCH(Dashboard!G18,dtPages!C1:R1,0)), dtPages!T:T,Dashboard!X11,dtPages!U:U,Dashboard!X13), "某事")
OR
=IF(AND(Dashboard!G11="全部", Dashboard!G18<>"全部"), SUMIFS(INDEX(dtPages!C2:R,0,MATCH(Dashboard!G18,dtPages!C1:R1,0)), dtPages!T2:T,Dashboard!X11,dtPages!U2:U,Dashboard!X13), "某事")
将dtPages
选项卡中的C2:R
、T2:T
、U2:U
对齐,以使行大小相同,以修复SUMIFS的数组参数大小不同
错误
尝试的替代公式
=sum(ifna(filter(choosecols(dtPages!C2:R,xmatch(Dashboard!G18,dtPages!C1:R1)),dtPages!T2:T=Dashboard!X11,dtPages!U2:U=Dashboard!X13)))
英文:
Try either
=IF(AND(Dashboard!G11="All", Dashboard!G18<>"All"), SUMIFS(INDEX(dtPages!C:R,0,MATCH(Dashboard!G18,dtPages!C1:R1,0)), dtPages!T:T,Dashboard!X11,dtPages!U:U,Dashboard!X13), "SOMETHING")
OR
=IF(AND(Dashboard!G11="All", Dashboard!G18<>"All"), SUMIFS(INDEX(dtPages!C2:R,0,MATCH(Dashboard!G18,dtPages!C1:R1,0)), dtPages!T2:T,Dashboard!X11,dtPages!U2:U,Dashboard!X13), "SOMETHING")
Aligning C2:R
, T2:T
, U2:U
within dtPages
tab to have same row size to fix the Array arguments to SUMIFS are of different size
error
Alternate formula to try out
=sum(ifna(filter(choosecols(dtPages!C2:R,xmatch(Dashboard!G18,dtPages!C1:R1)),dtPages!T2:T=Dashboard!X11,dtPages!U2:U=Dashboard!X13)))
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论