How to Count cells which match either A or B in Excel.

In this article, we will learn about how to Count cells that equals either A or B value using COUNTIF function in Excel. In simple words, Consider a scenario in which we are required to count the data based on specific criteria in an array. counting cells that have either A or B value using the wildcards to catch cell value with countif function in excel explained here with an example. The COUNTIF function returns the count of cells which have either Value 1 or value 2. Generic formula:

=COUNTIF (range, “value1”) + COUNTIF (range, “value2”)

Range : array Value1 : value in quotes + : OR operator with COUNTIF Wildcard characters for catching strings and perform functions on it. There are three wildcard characters in Excel

  1. Question mark ( ? ) : This wildcard is used to search for any single character.
  2. Asterisk ( * ): This wildcard is used to find any number of characters preceding or following any character.
  3. Tilde ( ~ ): This wildcard is an escape character, used preceding the question mark ( ? ) or asterisk mark( * ).

Let’s understand this function using it in an example. 002 There are different shades of colours in the array. We need to find the colours which have either Blue or red. Use the formula:

=COUNTIF(A2:A13,"*red*")+COUNTIF(A2:A13,"*Blue*")

A2:A13 : array *red* : matches cells where red exist + : operator to concatenate results The formula drops down to =6 (Blue)+3 (red) = 9 003 There are 9 cells which have either Blue or red. As you can see the COUNTIF formula returns the count of cells which do not have a specific value. Hope you understood how to Count cells which match either A or B in Excel. Explore more articles on Excel text functions here. Please feel free to state your query. We will surely assist you.

 

Related Articles

Get the COUNTIFS with Dynamic Criteria Range in Excel

Get the COUNTIFS Two Criteria Match in Excel

Get the COUNTIFS With OR For Multiple Criteria in Excel

How to use the COUNTIFS Function in Excel

How to use the Countif in VBA in Microsoft Excel

Popular Articles

50 Excel Shortcut to Increase Your Productivity

Edit a dropdown list

If with conditional formatting

If with wildcards

Vlookup by date

Leave a Reply

Your email address will not be published. Required fields are marked *

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.