简体   繁体   中英

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.

I'm familiar with Countifs, but it was the "if blank" portion that I've been really struggling with. 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. 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. 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. Dont ask me why!

As workaround, you can use the flexible and never vexing SUMPRODUCT :

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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