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

Posted by Jay Elston on Stack Overflow See other posts from Stack Overflow or by Jay Elston
Published on 2010-05-09T22:48:57Z Indexed on 2010/05/09 22:58 UTC
Read the original article Hit count: 204

I have a spreadsheet that has a column of cells where each cell contains a single work. 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.

© Stack Overflow or respective owner

Related posts about excel

Related posts about not-programming-related