0

我正在尝试在6 月 21 日至 6 月 21 日之间的日期之间制作单元格G5 SUMCOUNTIF(不确定哪个更好)表格列中的OPEN's 和's 的数量。CLOSEDASPREADS LOG

但是,如果没有OPENCLOSED在此日期范围之间,我想G5返回一个空白。

这是当前的公式G5

=IF(COUNTIFS('SPREADS LOG'!A:A,"OPEN",'SPREADS LOG'!R:R,">="&DATE(2021,2,1),'SPREADS LOG'!R:R,"<="&DATE(2021,2,28)),COUNTIFS('SPREADS LOG'!A:A,"CLOSED",'SPREADS LOG'!R:R,">="&DATE(2021,2,1),'SPREADS LOG'!R:R,"<="&DATE(2021,2,28)),"")

如果有人可以对此进行调整,那就太好了。

4

2 回答 2

0

在我的数据中,我在 A 列中有状态,在 B 列中有日期。

单元格 E2 中的公式:

=IF(SUM(COUNTIFS(A:A,{"open","closed"},B:B,">="&DATE(2021,2,1),B:B,"<="&DATE(2021,2,28)))=0,"",SUM(COUNTIFS(A:A,{"open","closed"},B:B,">="&DATE(2021,2,1),B:B,"<="&DATE(2021,2,28))))

在此处输入图像描述

于 2021-02-17T15:15:30.300 回答
0

您的公式非常接近,但我确实建议进行一些更改以获得您想要的。

首先是在某处(同一张表或不同的表)建立几个单元格来定义您的开始和完成日期。这样,如果您需要更改日期的检查范围,则不必重写公式。所以...

Cell Z1 = 6/1/2021
Cell Z2 = 6/30/2021

然后你的计数函数变为:

COUNTIFS('SPREADS LOG'!A:A,"OPEN",'SPREADS LOG'!R:R,">="&Z1,'SPREADS LOG'!R:R,"<="&Z2)

之后,它只是一个简单的添加:

=COUNTIFS('SPREADS LOG'!A:A,"OPEN",'SPREADS LOG'!R:R,">="&Z1,'SPREADS LOG'!R:R,"<="&Z2)+COUNTIFS('SPREADS LOG'!A:A,"CLOSED",'SPREADS LOG'!R:R,">="&Z1,'SPREADS LOG'!R:R,"<="&Z2)

由于您想将零计数显示为空白,请将单元格的自定义数字格式设置为0;-0;;@更多信息here)。这样可以避免使您的公式过于复杂。

于 2021-02-17T15:15:39.793 回答