However, for reasons explained below, COUNTIF won’t work.

Instead, you could use the SUMPRODUCT andBoolean logic.

See below for a full explanation.

Excel formula: Count cells that contain n characters

You would think you could use the COUNTIF function with the question mark (?)

As a result, COUNTIF will never find a matching number and the result will always be zero.

This happens because COUNTIF is in agroup of eight functions that require an actual rangeforrangearguments.

Excel formula: Count specific characters in text string

To do this, we use adouble negative(–).

This version of the formula will work when there are numbers in column D, or text values.

For example, =MID(“apple”,2,3) returns “ppl”.

Excel formula: Count cells that begin with

Excel formula: Count numbers that begin with

Excel SUMPRODUCT function

Excel MID function