Count cells that contain specific text with case sensitive
Normally, applying standard functions like COUNTIF or COUNTIFS can’t handle case sensitive. To count cells that contain specific text with case sensitive (exactly match the case text in specified cells), you can apply the combination of the SUMPRODUCT, ISNUMBER and the FIND functions to get it done. In this tutorial, you will learn how to use this formula in details to count the number of cells that contains specific text with case sensitive in a range in Excel.
How to count cells that contain specific text with case sensitive
Please do as follows to count the number of cells that contains specific text with case sensitive in a range in Excel.
Generic Formula
=SUMPRODUCT(--ISNUMBER(FIND(criteria,criteria_range)))
Arguments
Criteria (required): The text or text string you want to count cells based on;
Criteria_range (required): The range in which you want to count cells with case sensitive.
How to use this formula?
As the below screenshot shown, to count the number of cells in range B3:B9 that contain the text in D3:D5 with case sensitive, please do as follows to get it done.
1. Select a blank cell to output the result (here I select E3).
2. Enter the below formula into it and press the Enter key. Select the result cell, and then drag its AutoFill Handle over the below cells to apply the formula.
=SUMPRODUCT(--ISNUMBER(FIND(D3,$B$3:$B$9)))
How these formulas work?
=SUMPRODUCT(--ISNUMBER(FIND(D3,B3:B9)))
- 1. FIND(D3,B3:B9): The FIND function is always case-sensitive. It checks for whether the value (“KTE”) in D3 existing in the specified range (B3:B9), and returns an array: {1,#VALUE!, #VALUE!, #VALUE!, #VALUE!,1, #VALUE!}.
In this array, each number 1 represents the corresponding cell in range B3:B9 containing “KTE”, and each #VALUE indicates a cell in range B3:B9 does not contain “KTE”. - 2. ISNUMBER{1,#VALUE!, #VALUE!, #VALUE!, #VALUE!,1, #VALUE!}: The ISNUMBER function returns TURE if meeting numbers in the array, and returns FALSE if meeting errors. Here returns the result as {TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE}.
- 3. --{TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE }: These two minus signs convert “TRUE” into 1 and convert “FALSE” into 0. Here you will get a new array as {1;0;0;0;0;1;0}.
- 4. =SUMPRODUCT{1;0;0;0;0;1;0}: The SUMPRODUCT sums all number in the array and returns the final result as 2 in this case.
Related functions
Excel SUMPRODUCT function
The Excel COUNTBLANK function can be used to multiply two or more columns or arrays together, and then get the sum of products.
Excel ISNUMBER function
The Excel ISNUMBER function returns TRUE when a cell contains a number, and FALSE if not.
Excel FIND function
The Excel FIND function is used to find a string within another string, and returns the starting position of the string inside another one.
Related formulas
Count cells that begin or end with specific text
This article is going to show you how to count cells that begin or end with specific text in a range in Excel with the COUNTIF function.
Count Blank/Nonblank Cells
This article explains formulas to count the number of blank and nonblank cells in a range in Excel.
Count Cells That Contain Either X Or Y
this tutorial is going to show you how to apply a formula based on the SUMPRODUCT function in details to count the number of cells in a specific range that contain either x or y in Excel.
Count how many cells contain errors
This tutorial shows how to count the number of cells that contains errors (any kind of errors, such as #N/A error, #VALUE! error or #DIV/0! error) in a specified range in Excel.
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...
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, Edge and Firefox.