Countif有多个OR标准 [英] Countif With Multiple OR Criteria
本文介绍了Countif有多个OR标准的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要计算列中包含特定值的单元格数。我正在使用以下代码:
I need to count the number of cells in a column which contain a specific value. I am currently using the following code:
iVal = Application.WorksheetFunction.COUNTIF(Range(A:A),SAL)
但是,现在我需要计算多少个单元格包含
However, I now need to count how many cells contain either
-
SAL
,或 -
PRE
SAL
, orPRE
推荐答案
最快的方法就是做2个COUNTIF: p>
The quickest way would just be to do 2 COUNTIFs:
iVal = Application.WorksheetFunction.CountIf(Range("A:A"), "SAL") + Application.WorksheetFunction.CountIf(Range("A:A"), "PRE")
这篇关于Countif有多个OR标准的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文