根据列标题在SUMIFS公式中求列的和。

huangapple go评论116阅读模式
英文:

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=&quot;All&quot;, Dashboard!G18&lt;&gt;&quot;All&quot;), SUMIFS(INDEX(dtPages!C2:R,0,MATCH(Dashboard!G18,dtPages!C1:R1,0)), dtPages!T:T,Dashboard!X11,dtPages!U:U,Dashboard!X13), &quot;SOMETHING&quot;)

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=&quot;All&quot;, Dashboard!G18&lt;&gt;&quot;All&quot;), SUMIFS(SUMPRODUCT((dtPages!C2:R)*(dtPages!C1:R1=Dashboard!G18)), dtPages!T:T,Dashboard!X11,dtPages!U:U,Dashboard!X13), &quot;ERROR&quot;)

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:RT2:TU2: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=&quot;All&quot;, Dashboard!G18&lt;&gt;&quot;All&quot;), SUMIFS(INDEX(dtPages!C:R,0,MATCH(Dashboard!G18,dtPages!C1:R1,0)), dtPages!T:T,Dashboard!X11,dtPages!U:U,Dashboard!X13), &quot;SOMETHING&quot;)

OR

=IF(AND(Dashboard!G11=&quot;All&quot;, Dashboard!G18&lt;&gt;&quot;All&quot;), SUMIFS(INDEX(dtPages!C2:R,0,MATCH(Dashboard!G18,dtPages!C1:R1,0)), dtPages!T2:T,Dashboard!X11,dtPages!U2:U,Dashboard!X13), &quot;SOMETHING&quot;)

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)))

huangapple
  • 本文由 发表于 2023年8月10日 22:45:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/76876842.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定