 In Microsoft Excel (part of the Microsoft Office productivity suite), you can count the number of times a string (a piece of text) appears in a range of cells.

Let’s take the following table as an example:

 Option A Option B Option C Totals X X 2 X 1 X X X 3

To get the totals automatically (in other words: how many times does ‘X’ appear in this row?), use the following formula:

`=COUNTIF(E4:H4,"X")`

The formula says: if in range E4 to H4 the value ‘X’ appears, count this and output the total.

However, upon entering this formula, I received an error prompt telling me:

The formula you typed contains an error.

For information about fixing common formula problems, click help.

To get assistance in entering a function, click Function Wizard (Formulas tab, Function Library group).

If you are not trying ot enter a formulam avoid using an equal sign (=) or minus sign (-) or precede it with a single quotation mark (‘).

So the COUNTIF function is not working? And this error message wasn’t all too helpful either. Luckily, I tried other notations and finally found an answer. I had to replace the comma (,) with a semicolon (;).

The COUNTIF formula now becomes a working one:

`=COUNTIF(E4:H4;"X")`

## 4 thoughts on “Excel: COUNTIF: The formula you typed contains an error”

1. Bob Doering says:

What’s wrong with this formula?
=AND(FIND(“@”,K1),FIND(“.”,K1),ISERROR(FIND(” “,K1),ISERROR(FIND(“,”,K1))))

2. melvin says:

Thank you so much even Microsoft is giving the wrong answers!