# Count cells based on text content (Gnumeric)

I have a spreadsheet with columns that are basically booleans, they contain either "Yes" or "No", I want a total count of all the cells in a range that are "Yes".

I imagine this would be done something like summing all the cells in a range where Yes=1 and No=0, but I don't know.

I am looking for a solution that works in Gnumeric, but if you know how to do this in Excel, that may prove useful. I understand that Gnumeric's syntax is very similar to Excel's (more so than OOO's spreadsheet's), so it might just work.

I'm not sure if Gnumeric has the COUNTIF function but since you asked for an Excel solution here it is. Let's say that the cells you are counting are A1 to A99. You would click on another cell where you want to display the count and put in this formula:

``````=COUNTIF(A1:A99,"YES")
``````

The cell will display the number of YES's. If you want to count the number of NO's it would be simply:

``````=COUNTIF(A1:A99,"NO")
``````
• I just verified it. It works in Gnumeric. – Marcin Jan 10 '10 at 5:44

In the version I use (1.10.17) the correct syntax is `countif(A1:A99;"YES")` (semicolon instead of comma).

[Intended as a comment to Marcin's answer, but I cannot comment yet…]