使用 OR &AND 在 COUNTIFS 中 [英] Using OR & AND in COUNTIFS
本文介绍了使用 OR &AND 在 COUNTIFS 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想为我的 COUNTIFS
子句中的一个条件添加一个 "AND"
条件.
I would like to include an "AND"
condition for one of the conditions I have in my COUNTIFS
clause.
类似这样的:
=COUNTIFS(A1:A196;{"Yes"or "NO"};J1:J196;"Agree")
所以,它应该返回行数,其中:
So, it should return the number of rows where:
(A1:A196 is either "yes" or "no") AND (J1:j196 is "agree")
推荐答案
你可以把几个 COUNTIF
语句加在一起:
You could just add a few COUNTIF
statements together:
=COUNTIF(A1:A196,"yes")+COUNTIF(A1:A196,"no")+COUNTIF(J1:J196,"agree")
这将为您提供所需的结果.
This will give you the result you need.
编辑
抱歉,误读了问题.尼古拉斯是对的,上面的内容会加倍计算.我没有以正确的方式考虑 AND
条件.这是一个可以为您提供正确结果的替代方法,您一开始就非常接近:
Sorry, misread the question. Nicholas is right that the above will double count. I wasn't thinking of the AND
condition the right way. Here's an alternative that should give you the correct results, which you were pretty close to in the first place:
=SUM(COUNTIFS(A1:A196,{"yes","no"},J1:J196,"agree"))
这篇关于使用 OR &AND 在 COUNTIFS 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文