Excel Formulas - Count cells with OR condition
Count cells with OR condition
Syntax of used function(s)
COUNTIF(criteria_range, criteria)
Explanation
To count the number of cells equal to one or another value, COUNTIF function can be used. In the example below D8 cell contain the formula and the COUNTIF function used twice.
Formula
=COUNTIF(B5:B10,"Anney")+COUNTIF(B5:B10,"Jack")
How the formula works
COUNTIF counts the number of cells within a range that match the criteria given in the argument. In the above example, the criteria for the first
COUNTIF is "Anney" and the criteria for the second COUNTIF is "Jack". The first COUNTIF search "Anney" within the range B5:B10 and the second
COUNTIF search the "Jack" within the range B5:B10 and return count. These two counts then added together and the sum is returned as the result of the formula.
Count cells with OR condition using range name and criteria
Formula
=COUNTIF(Employee,D8)+COUNTIF(Employee,E8)
How the formula works
COUNTIF counts the number of cells within a range that match the criteria given in the argument. In the above example, the criteria for the first
COUNTIF is "Anney" and the criteria for the second COUNTIF is "Jack". The first COUNTIF search "Anney" within the range B5:B10 and the second
COUNTIF search the "Jack" within the range B5:B10 and return count. These two counts then added together and the sum is returned as the result of the formula.
Previous: Excel Formulas - Count multiple criterias using logical NOT
Next:
Excel Formulas - Count cells using greater than operator
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/excel/formulas/count/count-cells-with-or-condition.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics