Excel SUMIFS对于两个条件和=MONTH函数会出现#Error错误。

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

Excel SUMIFS throws #Error for two criterias and =MONTH function

问题

我在Excel中有以下情况,其中我根据日期和任务记录了小时数。
根据=UNIQUE(),我在I列中添加了所有我的任务,在J列中,我试图根据任务和在I2中定义的当前月份添加小时数。

这个公式会给我返回#Error,但我真的无法理解为什么。

谢谢您的时间!

英文:

I have the following case in Excel where I have hours based on date and task.
Excel SUMIFS对于两个条件和=MONTH函数会出现#Error错误。

Based on an =UNIQUE() I add all my tasks in I column and in J column I am trying to add the hours based the task and the current month defined on I2.

Excel SUMIFS对于两个条件和=MONTH函数会出现#Error错误。

That formula will throw me the #Error but I can't really understand why.

Thank you for your time!

答案1

得分: 2

=SUMIFS(D:D, C:C, I4, INDEX(MONTH(A:A), I$2))

  • 参数 month(A3:A) 没有应用于整个 A3:A 列范围,与将其写为 month(A3) 相同。您可能需要将其包装在 arrayformula / index 中,以便应用于整个列范围。否则,您将收到 Array arguments to SUMIFS are of different size. 错误。
英文:

<!-- language-all: js -->

You may try this in Sheets

=sumifs(D:D,C:C,I4,index(month(A:A)),I$2)
  • the parameter month(A3:A) is not applied across the whole A3:A column_range & is same as writing it as month(A3). You may need to wrap it in an arrayformula / index so that it is applied to the whole column_range. Otherwise you will be prompted with Array arguments to SUMIFS are of different size. error

Excel SUMIFS对于两个条件和=MONTH函数会出现#Error错误。

答案2

得分: 1

Sure, here are the translated parts:

  1. 使用真实日期来比较日期列,以获取条件月份的第一个日期和最后一个日期。尝试使用以下公式:

=SUMIFS($D$3:$D,$C$3:$C,$F4,$A$3:$A,">="&DATE(2023,$G$3,1),$A$3:$A,"<="&EOMONTH(DATE(2023,$G$3,1),0))

  1. 另一个不错的选择是使用 QUERY() 函数。这个公式可以在不手动添加其他公式的情况下获得结果。尝试使用以下公式:

=QUERY(HSTACK(INDEX(MONTH(A3:A)),C3:D),"select Col2,sum(Col3) where Col1=" & G3 & " group by Col2 label Col2 'Tasks', sum(Col3) 'Total')

如果需要更多帮助,请告诉我。

英文:

Use a true date to compare date columns for 1st date and last date of criteria month. Try-

=SUMIFS($D$3:$D,$C$3:$C,$F4,$A$3:$A,&quot;&gt;=&quot;&amp;DATE(2023,$G$3,1),$A$3:$A,&quot;&lt;=&quot;&amp;EOMONTH(DATE(2023,$G$3,1),0))

Excel SUMIFS对于两个条件和=MONTH函数会出现#Error错误。

Another good choice could be using QUERY() function. This formula will give results without manually putting other formulas. Try-

=QUERY(HSTACK(INDEX(MONTH(A3:A)),C3:D),
&quot;select Col2,sum(Col3)
where Col1=&quot; &amp; G3 &amp; &quot; group by Col2 label Col2 &#39;Tasks&#39;, sum(Col3) &#39;Total&#39;&quot;)

Excel SUMIFS对于两个条件和=MONTH函数会出现#Error错误。

huangapple
  • 本文由 发表于 2023年7月6日 17:14:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76627277.html
匿名

发表评论

匿名网友

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

确定