本文介绍了如何将COUNTIF与OR结合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Google Spreadsheets中,我需要在具有多个条件的范围内使用COUNTIF
函数.因此,在下表中,我需要输入类似=COUNTIF(B:B,"Mammal"or"Bird")
的值,并返回值4.
In Google Spreadsheets, I need to use the COUNTIF
function on a range with multiple criteria. So in the table below, I would need to have something like =COUNTIF(B:B,"Mammal"or"Bird")
and return a value of 4.
A |B
-------------------
Animal | Type
-------------------
Dog | Mammal
Cat | Mammal
Lizard | Reptile
Snake | Reptile
Alligator | Reptile
Dove | Bird
Chicken | Bird
我没有运气就尝试了很多不同的方法.
I've tried a lot of different approaches with no luck.
推荐答案
一个选项:
=COUNTIF(B:B; "Mammal") + COUNTIF(B:B; "Bird")
根据文档:
COUNTIF 只能使用单个条件执行条件计数. 要使用多个条件,请使用 COUNTIFS 或数据库功能 DCOUNT 或 DCOUNTA .
COUNTIF can only perform conditional counts with a single criterion. To use multiple criteria, use COUNTIFS or the database functions DCOUNT or DCOUNTA.
COUNTIFS
:此功能仅在.
示例:
=DCOUNTA(B:B; 2; {"Type"; "Mammal"; "Bird"})
这篇关于如何将COUNTIF与OR结合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!