« Macros: Prime numbers | Main | A simple recursive macro: GCD »
September 08, 2004
Cell Counting 1: COUNTIF
One of the most useful and versatile builtin functions in OOo Calc, with a bit of creativity, you can use for a slew of tasks...How many cells in a given range are negative.
=COUNTIF(A1:A20;"<0")
How many cells have the string "Yes".
=COUNTIF(A1:A20;"Yes")
Don't forget to include the quotation marks around the condition argurment. Otherwise, you get an Err:510
Stefano Lenzi commented if you want that your criteria contains reference to other cells you can refer to the following example.
To count the cells less then A3:
=COUNTIF("A1:A20";CONCATENATE("<";A3))
Posted by Dave at September 8, 2004 04:41 AM