Countif / Sumif应该在arrayformula中显示空值而不是0

时间:2019-06-20 09:58:08

标签: filter google-sheets google-sheets-formula array-formulas google-sheets-query

我有许多围绕countif和sumifs函数的arrayformulas。我希望countifs / sumifs返回一个空值(“”)而不是0。

我的解决方法非常昂贵且耗时长:

=ARRAYFORMULA(IF(SUMIFS(Sheet!$C$1:$C; 'Sheet!$A$1:$A; ">="&$A3; Sheet!$A$1:$A; "<="&$B3)=0; ""; SUMIFS(Sheet!$C$1:$C; Sheet!$A$1:$A; ">="&$A3; Sheet!$A$1:$A; "<="&$B3)))

以下是示例工作表:https://docs.google.com/spreadsheets/d/1xyS0Y4gnG3zLyOGtycWytvTlA1NmqjEAy8H7QJatdSg/edit?usp=sharing

有其他方法吗?

1 个答案:

答案 0 :(得分:1)

=IFERROR(SUM(QUERY(Sheet2!A:C; 
 "select C 
  where month(A)+1="&MONTH(A3)&" 
    and year(A)="&YEAR(A3); 0)))

0


=IFERROR(SUM(FILTER(Sheet2!C:C; 
 YEAR(Sheet2!A:A)=YEAR(A3); MONTH(Sheet2!A:A)=MONTH(A3))))

0