How to Use COUNTIFS function with Multiple Criteria and OR Logic in Excel

This post will guide you how to Use COUNTIFS function with multiple criteria and OR logic in Excel 2013/2016 or Excel office 365. How to count with multiple criteria and OR logic in Excel.

COUNTIFS with Multiple Criteria and OR Logic


Normally, when you provide multiple conditions to a COUNTIFS function, and it will check all the conditions and returns rows which matches all the conditions, it means that it runs on AND logic.

If you want to count with multiple conditions and OR logic in your formula, and you can also use the COUNTIFS function to achieve OR logic. Then you still need to use the SUM function and array with multiple condition.

The generic formula is as below:

=SUM(COUNTIFS(range1,{criteria1,criteria2},range2,{criteria3,criteria4}…))

Example


Assuming that you have a list of data in range B1:B6 in your worksheet, and you wish to count product name which is “excel” or “word”, and you can use the COUNTIFS function with an array constant. The formula is like this:

=SUM(COUNTIFS(B1:B6,{“excel”,”word”}))

countifs function with multiple criteria or logic1

Let’s See That How This Formula Works:

=COUNTIFS(B1:B6,{“excel”,”word”})

countifs function with multiple criteria or logic2

The COUNTIFS function can be used to match each item of condition array {“excel”, “word”} and return count of each item in another array list. It means that it will return two values, one is a count for “excel” and another is a count for “word”, the array result is like this:

{2,1}

countifs function with multiple criteria or logic3

Finally, you can use the SUM function to add up all items in an array.

Adding Two or Multiple Criteria with OR Logic


You can also add two or more criteria to this formula to count multiple criteria using COUNTIFS function with OR logic in Excel. You ‘ll need to add another single column array for one or add another single column array for the other criteria. For example, you wish to count product names that are “excel” or “word”, another criteria is “2016” or “2013”, you can use the below formula:

=SUM(COUNTIFS(B1:B6,{“excel”,”word”},C1:C6,{“2016″,”2013”}))

countifs function with multiple criteria or logic4

Related Functions


  • Excel COUNTIFS function
    The Excel COUNTIFS function returns the count of cells in a range that meet one or more criteria. The syntax of the COUNTIFS function is as below:= COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2]…)…
  • Excel SUM function
    The Excel SUM function will adds all numbers in a range of cells and returns the sum of these values. You can add individual values, cell references or ranges in excel.The syntax of the SUM function is as below:= SUM(number1,[number2],…)

 

 

Related Posts

If Cell Begins with One of Three Supplied Characters
If Cell Begins with One of Three Supplied Characters

If you want to test values to see if they begin with some given specific characters like “x”, ”y”, or “z”, you can create a formula with COUNTIF and SUM functions to return results. EXAMPLE You can see “TRUE” or ...

Average per Week by Formula in Excel
Average per Week 1

We usually apply AVERAGE function or relevant functions to return average directly in Excel worksheet. But in some situations, only applying average relevant functions cannot figure out our problem. Sometimes we can create a formula with functions and mathematical operation ...

How to Sum if Contains an Asterisk
How to Sum if Contains an Asterisk 7

To add numbers together we need to apply SUM function. And if we want to add numbers based on some conditions, we can add criteria with the help of SUMIFS function, SUMIFS can filter data with multiple criteria effectively. If ...

How to Sum in Vertical Range
How to Sum in Vertical Range 8

If we want to add numbers based on some conditions in Excel worksheet, we can add criteria with the help of SUMIFS function, SUMIFS can filter data with multiple criteria effectively. In this article, we will introduce you the method ...

How to Sum in Horizontal Range
How to Sum in Horizontal Range9

To add numbers together we need to apply SUM function. But if we want to add numbers based on some conditions, we can add criteria with the help of SUMIFS function, SUMIFS can filter data with multiple criteria effectively. In ...

How to Sum with Criteria and Or Logic in Excel
How to Sum with Criteria and Or Logic in Excel 8

To add numbers together we need to apply SUM function. And if we want to add numbers based on some conditions, we can add criteria with the help of SUMIFS function, SUMIFS can filter data with multiple criteria effectively. If ...

How To Sum the Largest N Values in Excel

Sometimes we may want to sum the largest N numbers or top N numbers in a range. In this article, we will show you the method of “SUM the Largest N Numbers” by a simple formula which consist of SUMPRODUCT ...

How to Sum for Cell Contains Formula Only in Excel
How to Sum for Cell Contains Formula Only in Excel 9

Sometimes values are created by formulas in cells. If we want to sum values which are created by formulas from a range, but some values which are hardcoded also list in the same range, how can we filter out matched ...

How to Sum the Smallest N Values in Excel
How to Sum the Smallest N Values in Excel 15

Sometimes we may want to sum the first smallest N numbers in a range in Excel. In this article, we will show you the method of “SUM the Smallest N Numbers” by a simple formula which consist of SUMPRODUCT and ...

How to Subtotal Values for Groups and Only Keep One Subtotal for A Group in Column
How to Subtotal Values for Groups and Only Keep One Subtotal for A Group in Column14

Sometimes we may meet the case that subtotal values for different groups and only record a subtotal value for one group in a column, for other cells in this group, keep them blank. Today we will introduce you how can ...

Sidebar