# Countif text not recognized

#### pleeseemailme

##### Board Regular
Howdy,

I have a report that spits out batches of information into a csv file. Before each batch, the report inserts the text: ">>>". I need to count the number of batches in each report, so I tried: =COUNTIF(A:A,">>>"). For whatever reason, this actually counts each cell with a value in it and not just the cells with ">>>". I've gotten around it by using the array formula: =SUM(IF(A:A=">>>",1,0)). However, I was curious if anyone could shed some light as to why the COUNTIF formula doesn't work; I'd like to learn why. Thank once again to you all.

### Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Howdy,

I have a report that spits out batches of information into a csv file. Before each batch, the report inserts the text: ">>>". I need to count the number of batches in each report, so I tried: =COUNTIF(A:A,">>>"). For whatever reason, this actually counts each cell with a value in it and not just the cells with ">>>". I've gotten around it by using the array formula: =SUM(IF(A:A=">>>",1,0)). However, I was curious if anyone could shed some light as to why the COUNTIF formula doesn't work; I'd like to learn why. Thank once again to you all.

Consider:
 FALSE FALSE < FALSE FALSE >>> FALSE TRUE s TRUE TRUE x TRUE TRUE 3 FALSE FALSE

<TBODY>
</TBODY>

[1] B1, copied down:

=A1 > ">>>"

[2] C1, copied down:

=A1 > "="&">>>"

[3]

=COUNTIF(A:A, ">>>")

===> 3

[4]

=COUNTIF(A:A,"="&">>>")

===> 1

COUNTIF behaves the same as D-functions...

If you want eliminate the effect of the > comparison operator, you need to invoke the COUNTIF formula with an = operator.

The behavior in [3] is copmparable with:

=COUNTIF(A:A, ">>")

or

=COUNTIF(A:A,">"&">")

or

=COUNTIF(A:A,">"&">>")

Conclusion: You need to neutralize the effect of the > operator.

This is a guess.

The > is the operator greater than.

I think the COUNTIF function is interpreting this ">>>" as counting all cells as greater than ">>"
The first > is interpreted as an operator.

=COUNTIF(A:A,"=>>>")

That did it. I just needed the "=" sign. It makes sense now that it was looking for cells greater than ">>". Thanks so much!

Replies
1
Views
168
Replies
2
Views
594
Replies
5
Views
424
Replies
7
Views
575
Replies
2
Views
396

1,216,373
Messages
6,130,226
Members
449,567
Latest member
ashsweety

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back