Information in the LibreOffice help.
COUNTIF
Returns the number of cells that meet with certain criteria within a cell range.
The search supports regular expressions. You can enter “all.*”, for example to find the first location of “all” followed by any characters. If you want to search for a text that is also a regular expression, you must precede every character with a \ character.
You can switch the automatic evaluation of regular expression on and off in Tools - Options - LibreOffice Calc - Calculate.
Syntax
COUNTIF(Range; Criteria)
Range is the range to which the criteria are to be applied.
Criteria indicates the criteria in the form of a number, an expression or a character string. These criteria determine which cells are counted. You may also enter a search text in the form of a regular expression, e.g. b.* for all words that begin with b. You may also indicate a cell range that contains the search criterion. If you search for literal text, enclose the text in double quotes.
Example
A1:A10 is a cell range containing the numbers 2000 to 2009. Cell B1 contains the number 2006. In cell B2, you enter a formula:
=COUNTIF(A1:A10;2006) - this returns 1
=COUNTIF(A1:A10;B1) - this returns 1
=COUNTIF(A1:A10;">=2006") - this returns 4
=COUNTIF(A1:A10;"<"&B1) - when B1 contains 2006, this returns 6
=COUNTIF(A1:A10;C2) where cell C2 contains the text >2006 counts the number of cells
in the range A1:A10 which are >2006
To count only negative numbers: =COUNTIF(A1:A10;"<0")