# Count cells equal to case sensitive

=SUMPRODUCT((--EXACT(value,range)))

To count cells that contain specific text, taking into account upper and lower case, you can use a formula based on the EXACT function together with the SUMPRODUCT function. In the example shown, E5 contains this formula, copied down:

=SUMPRODUCT((--EXACT(D5,names)))

Where "names" is the named range B5:B11. This provides a case-sensitive count of each name listed in column D.

### How this formula works

The EXACT function takes two arguments, text1 and text2. When text1 and text2 match exactly (respecting case), EXACT returns TRUE. Otherwise, EXACT returns FALSE:

In the example shown, we need check all values in column B each time we count a name in column D. Because we are giving EXACT multiple values, it returns multiple results. In E5, EXACT returns:

{FALSE;FALSE;FALSE;FALSE;TRUE;TRUE;TRUE}

Each TRUE represents an exact match of "ayako" in B5:B11. Because we want to count results, we use a double-negative (--) to convert TRUE and FALSE values into 1's and 0's. The resulting array is:

{0;0;0;0;1;1;1}

Finally, SUMPRODUCT sums the values in the array and returns 3.

*Note: Because SUMPRODUCT can handle arrays natively, it's not necessary to use Control+Shift+Enter to enter this formula.*

## Excel Formula Training

Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.