Using excel, how can I count the number of cells in a column containing the text "true" or "false"?

Posted by Jay Elston on Super User See other posts from Super User or by Jay Elston
Published on 2010-05-09T22:48:57Z Indexed on 2010/05/10 2:09 UTC
Read the original article Hit count: 320

Filed under:
|

I have a spreadsheet that has a column of cells where each cell contains a single word. I would like to count the occurrences of some words. I can use the COUNTIF function for most words, but if the word is "true" or "false", I get 0.

        A        B
1    apples      2
2    true        0
3    false       0
4    oranges     1
5    apples

In the above spreadsheet table, I have these formulas in cells B1, B2, B3 and B4:

=COUNTIF(A1:A5,"apples")
=COUNTIF(A1:A5,"true")
=COUNTIF(A1:A5,"false")
=COUNTIF(A1:A5,"oranges)

As you can see, I can count apples, but not true or false. I have also tried this:

=COUNTIF(A1:A5,TRUE)

But that does not work either.

Note -- I am using Excel 2007.

© Super User or respective owner

Related posts about excel

Related posts about worksheet-function