Contact

COUNTIF Function (Gnumeric)

Math Beginner Gnumeric

Count cells meeting one criterion in Gnumeric with COUNTIF, category matches, numeric thresholds and escaped wildcards.

Verification status: Gnumeric 1.12.57 ssconvert bounded COUNTIF fixtures, with a separate primary-example GUI capture; pinned/retained 1.12.62 source inspected separately. How formula examples are checked

COUNTIF counts cells in one range that meet a single criterion. It returns a count, not a sum of amounts from another column. Use it for category frequencies or a single numeric threshold; multiple simultaneous conditions require an appropriate multi-condition approach.

Syntax and criterion construction

=COUNTIF(range,criteria)

Both arguments are required, with no optional defaults. range is the cell area to inspect. criteria is the comparison or match condition. Literal text criteria need quotation marks, such as “apple”. A numeric comparison can be written as “>=3”; to use a cell value, concatenate the operator and reference: ">="&D1.

Text matching in the tested Gnumeric cases is case-insensitive. An asterisk matches a sequence of characters and a question mark matches one character. Escape a literal wildcard with a tilde. For example, "*~**" means text containing an actual asterisk. These are wildcard conditions, not regular expressions.

Worked example: preserve the category table

Enter the following original practice table in A1:C5, without placing the headings in row 1:

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") returns 3. The retained second example =COUNTIF(C1:C5,"pear") returns 2. Neither formula adds the amounts in column B; it simply counts matching category cells.

=COUNTIF(C1:C5,"a*") also returns 3 in this dataset. The criterion matches categories beginning with a. It does not require exactly the word apple, so adding apricot later would increase this wildcard count while leaving the exact apple count unchanged.

Advanced example: cell-driven thresholds and a bounded interval

Put 3 in D1 and enter =COUNTIF(A1:A5,">="&D1). The expected result is 3, counting quantities 3, 4 and 5. Referencing D1 rather than writing the digits inside the criterion lets the threshold change without editing the formula.

For quantities greater than 2 and at most 4, use =COUNTIF(A1:A5,">2")-COUNTIF(A1:A5,">4"). The expected result is 2, for quantities 3 and 4. This subtraction works because the second counted set is a subset of the first and both formulas inspect the same range. It is not a general way to combine unrelated conditions.

To check spaces and literal wildcards, put Apple, apple with one trailing space, and AB in E1:E3. =COUNTIF(E1:E3,"apple") returns 1 in the native fixture: case is ignored, but the trailing space is not. =COUNTIF(E1:E3,"*~**") returns 1 for AB.

Troubleshooting and boundaries

  • Criteria tip: Text conditions often need quotes; operators combined with cell references must be constructed carefully. ">="&D1 reads D1, whereas the literal string “>=D1” does not substitute the cell value.
  • If unexpected categories match, inspect wildcard characters and surrounding spaces before altering the data.
  • Keep criterion ranges aligned when combining separate formulas; otherwise you may be subtracting unrelated populations.
  • A count of zero means no matches under the criterion. It does not prove that the range contains no data or no errors.
  • Blank, numeric-text and error-cell criteria have specialized coercion behavior. Do not extrapolate the clean text and numeric examples here into a promise about every mixed-type criterion; test the actual imported data and criterion together.
  • These formulas use commas. A different spreadsheet locale may require a different argument separator; a separator change is not a change to the criterion string itself.

Availability and version history

  • Introduced: Documented by 1.12.62; original introduction not established.
  • Availability: Supported in Gnumeric 1.12.62, based on the function-specific registration.
  • Scope: Desktop; the fn-math function module must be included and enabled.
  • Source evidence: Retained official source reexamined October 17, 2026; fn-logical source freshly retrieved at the same pinned revision. No 1.12.62 native execution.

Official sources

Additional retained documentation

Native verification scope

On 17 October 2026, Gnumeric 1.12.57 ssconvert recalculated 7 bounded COUNTIF fixtures in C.UTF-8. The article reports their actual numerical, logical, text and error outputs. The original worked examples are included in the native fixtures. Other explanatory formulas are independently checked rather than described as additional runs. These fixture records are engine evidence; the separate primary-example GUI capture below does not certify untested criteria, coercions or other versions.

Native application screenshot

Gnumeric COUNTIF primary example formula and result in selected cell H1

Gnumeric 1.12.57, captured 17 October 2026. The selected H1 cell shows the primary example result, with its formula in the formula bar. Other visible rows are supplemental fixture cases. General number formatting preserves floating-point tails; the GUI locale was not independently recorded.