If you count the number of cells with numbers, please use the COUNT function. To count the number of cells that end with a case-sensitive text string, you can use the SUMPRODUCT function and the EXACT function.
Example: You are working on a database with the names in column A, and the salary in column B.
Formula 1: To count how many people have names ending with "SON" (case sensitive)
The EXACT function is case-sensitive. When the last three letters match the letters of "SON", it returns to true; otherwise, it returns to false.
The double hyphens (‐‐) convert true into 1 and false into 0.
There are two people's names ending with "SON": Aiden JOHNSON and Jack TAISON.
Formula 2: The text "SON" can be a reference cell, for example, if "SON" is in cell D3, please use the formula below:
The formula above is case-sensitive (e.g., SON, and not Son). To check the count of the cells ending with a noncase-sensitive test string, please check here.
Note: The SUMPRODUCT function
The SUMPRODUCT function adds all the multiplication results for all arrays.
=SUMPRODUCT(array1, [array2], [array3], …)
– Array1 is required, the first array is to multiply and then add.
– Array2 is optional, the second array is to multiply and then add.
– Array3 is optional, the third array is to multiply and then add.