COUNTIF Function (Gnumeric)
Learn the COUNTIF function in Gnumeric: Counts the arguments which meet the set conditions.
Reference checked: Examples have not been run in this spreadsheet application. How we verify guides
The COUNTIF function in Gnumeric is used for this task: Counts the arguments which meet the set conditions. Count matching categories in a sample table.
This guide explains how to read the formula, reproduce a concrete example, interpret its result and recognize common input mistakes.
Syntax and arguments
The worked formula below shows the argument order used for this example. Consult the linked software-specific function reference for optional parameters and edge cases.
Gnumeric formulas normally use commas (,) between arguments. These examples are written for Gnumeric rather than copied unchanged from LibreOffice Calc.
Worked example
Use this small practice sheet for the ranges referenced in the formula:
| Row | A (Quantity) | B (Amount) | C (Category) |
|---|---|---|---|
| 1 | 1 | 10 | apple |
| 2 | 2 | 20 | pear |
| 3 | 3 | 30 | apple |
| 4 | 4 | 40 | pear |
| 5 | 5 | 50 | apple |
=COUNTIF(C1:C5,"apple")
Expected result: 3.
Why it works: Count matching categories in a sample table. The specified sample table supplies the referenced cells.
Another practical example
Practice inputs: C1:C5 contains apple,pear,apple,pear,apple.
=COUNTIF(C1:C5,"pear")
Expected result: 2.
Count exactly the two rows labeled pear in the five-row sample sheet.
What to watch for
If matching unexpected entries, look for extra spaces in category text.
For LibreOffice Calc formulas, separators are commonly semicolons; the Gnumeric examples here use commas. The arithmetic or official reference supplies the expected result, but Gnumeric has not been executed for this review.
How to use it in your own spreadsheet
- Identify the cells or inputs that correspond to the sample values above.
- Enter the formula in an empty cell, changing the references or literal values to match your sheet.
- Compare the output with a manual check on a small known example.
- Extend the formula to a larger dataset only after you understand the result.
Common problems and practical checks
- Check the accepted numeric domain, units and array dimensions for the specific operation.
- If an error appears, check that the function arguments are of the expected type.
- A pasted formula may produce an error when it uses the other program’s argument separator or unsupported options.
Criteria tip: Text conditions often need quotes; operators combined with cell references should be constructed carefully. Keep the criterion ranges aligned with the corresponding values.
Related functions
Documentation and verification
- Gnumeric official function reference
- Gnumeric function catalog
- The function name was checked against the official reference. A comparable example passed in LibreOffice Calc 25.2, but the example was not executed in this application. Confirm on your installed version before depending on it.