使用OR& AND in COUNTIFS [英] Using OR & AND in COUNTIFS

查看:140
本文介绍了使用OR& AND in 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.

编辑

对不起,错读了这个问题。尼古拉斯(Nicholas)是对的,以上观点将加倍计算。我没有想到 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 in COUNTIFS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆