Excel formula: Count cells equal to
This article will focus on the Excel formulas for counting the cells which are exactly equal to a text string you specify or partial equal to the given text string as below screenshots shown. Firstly, it will explain the formula syntax and argument, the provides examples for you to better understand.
Count cells exactly equal to
If you want to count cells exactly match a given criterion, you can choose the COUNTIF function or the SUMPRODUCT (combine with the EXACT function) function to count cells exactly equal to without case sensitive or with case sensitive.
Count cells exactly equal to without case sensitive
Generic formula:
COUNTIF(range, criteria) |
Arguments
|
Example:
For instance, here is a list of names, now you want to count the number of cells which exactly match to “Lily James”, please use below formula:
=COUNTIF(B3:B7,D3) |
Or
=COUNTIF(B3:B7,"Lily James") |
In above formulas, B3:B7 is the range you want to count cells from, D3 or “Lily James” is the criteria cells need to match to.
The press Enter key to get the counted result, see screenshot shown:
Count cells exactly equal to with case sensitive
Generic formula:
SUMPRODUCT((--EXACT(value,range)) |
Arguments
|
Example:
Here is a list of product names, now you want to count the number of cells which exactly match to “AA-1” with case sensitive, please use below formula:
=SUMPRODUCT(--EXACT(D11,B11:B15)) |
Or
=SUMPRODUCT(--EXACT("AA-1",B11:B15)) |
In above formulas, B11:B15 is the range you want to count cells from, D11 or “AA-1” is the criteria counted cells need to match to.
The press Enter key to get the counted result, see screenshot shown:
Count cells partial equal to
If you want to count cells particle match to a specific text string, you also can use the COUNTIF function to deal with this job.
Please take reference to above part to understand the formula syntax and argument of the COUNTIF function. Here I will provide a specific example to explain how to count cells particle equal to given value.
Example:
Here is a list of fruits, and now the job is to count the cells which contain “an”. Please use below formula:
=COUNTIF(B3:B7,D3) |
Or
=COUNTIF(B3:B7,"*an*") |
In above formulas, B3:B75 is the range you want to count cells from, D3 or “*an*” is the criteria counted cells need to match to. * is the wildcard to indicate any string, in this case, *an* means that the cell contain the string ”an”.
The press Enter key to get the counted result, see screenshot shown:
Sample File
Relative Formulas
- Count cells not equal to
With the COUNTIF function, you can count cells that not equal to or not contain a specified value. - Count cells that equal to x or y
In some times, you may want to count the number of cells that meet one of two criteria, in this case, you can use the COUNTIF function. - Count cells equal to x and y
Here this article introduce the formula to count cells that at the meanwhile match two criteria. - Count cells greater than or less than
This article talks about how to use the COUNTIF function to count the number of cell that greater than or less than a number
The Best Office Productivity Tools
Kutools for Excel - Helps You To Stand Out From Crowd
Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...
Supports Office/Excel 2007-2021 and 365 | Available in 44 Languages | Full-Featured 30-Day Free Trial.

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)
- One second to switch between dozens of open documents!
- Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
- Increases your productivity by 50% when viewing and editing multiple documents.
- Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Firefox, And New Internet Explorer.
