简体   繁体   English

Excel-CountIfs(列A具有目标值,列B为空白)

[英]Excel - CountIfs (column A has target value, column B is blank)

First post, sorry if it's not according to site preferences. 第一篇文章,对不起,如果它不是根据网站的喜好而定。 I searched around and couldn't find a post that was exactly like this, but sorry if this is a repeat as well. 我四处搜寻,却找不到完全像这样的文章,但抱歉,如果这也是重复的话。

I have the following code: 我有以下代码:

=COUNTIFS(A:A,"="&C3, B:B,"<>""")

For clarity, the code is supposed to identify instances where column A has a specific value (C3), and where column B is empty. 为了清楚起见,该代码应标识列A具有特定值(C3)且列B为空的实例。

I'm familiar with Countifs, but it was the "if blank" portion that I've been really struggling with. 我对Countifs很熟悉,但这是我一直在努力的“如果空白”部分。 On top of that, column B is populated with formulas, making this seemingly more challenging from my perspective as a couple methods I've tried only work if the cells are truly unpopulated. 最重要的是,列B填充了公式,从我的角度来看,这似乎更具挑战性,因为我尝试过的几种方法只有在单元格真正不填充的情况下才能起作用。 What I can say is that this formula is working with almost all of my examples, except 1, and I have no idea why this would be. 我可以说的是,除了1之外,此公式几乎适用于我的所有示例,我不知道为什么会这样。 For that matter I'm not entirely sure why this code works at all. 就此而言,我不完全确定为什么此代码完全起作用。

Any insight would be greatly appreciated. 任何见识将不胜感激。 Thank you very much. 非常感谢你。

To count if blank: "=" 要计数是否为空: "="

=COUNTIFS(A:A,"="&C3, B:B,"=")

Or if this is easier to understand: 或者,如果这更容易理解:

=COUNTIFS(A:A,"="&C3, B:B,"=" & "")

Which is the same. 都一样

"=" in COUNTIFS does not match blanks that result from formulas. COUNTIFS中的"="与公式COUNTIFS空格不匹配。 Dont ask me why! 不要问我为什么!

As workaround, you can use the flexible and never vexing SUMPRODUCT : 解决方法是,您可以使用灵活且永不烦恼的SUMPRODUCT

=SUMPRODUCT((A:A=C3)*(LEN(B:B)=0))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM