如何编写嵌套的 COUNTIF 公式?
有一个用于检查日期的列A列B列B列用于10个人的退房日期(10行数据)。找到有多少人在不使用辅助柱的情况下住了5天。
我尝试的(不起作用)---
=COUNTIF(DATEDIF(A2:A11,B2:B11, "d"), ">5")
这给了我一个错误。有正确的方法吗?
如果我使用助手列,则C = netatedif(a2,b2,“ d”)
,然后do = countif(c2:c11,“> 5”)
>它有效
,但是如何在没有助手列的情况下获得答案?
There is column A for check-in date, column B for check-out date for 10 individuals(10 rows of data). Find how many people stayed over 5 days WITHOUT using a helper column.
What I tried (doesn't work)---
=COUNTIF(DATEDIF(A2:A11,B2:B11, "d"), ">5")
This gave me an error. Is there a right way to do it?
If I use a helper column, C = DATEDIF(A2,B2,"d")
, and then do =COUNTIF(C2:C11, ">5")
it works
But how do I get the answer without the helper column?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试这样的方法,
COUNTIF()
函数适用于范围,而SUMPRODUCT()
函数适用于数组,因此最好使用后者,帮助程序显示它提供相同的输出,
• 单元格C2 中使用的公式
并向下填充!
• 单元格 D2 中使用的公式
COUNTIF()
不接受数组常量(据我所知)。• 单元格 A17 中使用的公式
您还可以创建如下所示的
COUNTIF()
类型公式(组合CTRL
+SHIFT +
ENTER
):• 单元格A15中使用的公式
注意:双重否定的使用 --> “双一元”,将 TRUE 或 FALSE 值强制转换为其等价数字 1 和 0。它用于需要数字进行特定数学运算的公式中。
You may try something like this,
COUNTIF()
Function works with a range, whileSUMPRODUCT()
Function with arrays, so its best to use the latter one,With helper showing that it gives the same output,
• Formula used in cell C2
And Fill Down!
• Formula used in cell D2
COUNTIF()
doesn't accept array constants (as far as I know).• Formula used in cell A17
You can also create a
COUNTIF()
type formula like this (the combinationCTRL
+SHIFT
+ENTER
):• Formula used in cell A15
Note: The use of double negative --> "double unary" which coerces TRUE or FALSE values to their numeric equivalents, 1 and 0. It's used in formulas where numbers are needed for a particular math operation.