Skip to main content
← All functions

COUNTIF function

Counts the number of cells within a range that meet the given criteria

Counts the number of cells within a range that meet the given criteria.

Syntax

COUNTIF(range, criteria)

Square brackets indicate optional arguments.

Arguments

ArgumentRequiredMeaning
rangeYesThe cells to test against the criterion. Text labels are counted when they match. Blank cells and empty text follow the chosen criterion.A1:A20
criteriaYesA number, expression, cell reference, or text string that determines which cells will be counted. For example, you can use a number like 32, a comparison like ">32", a cell like B4, or a word like "apples". COUNTIF uses only a single criteria. Use COUNTIFS if you want to use multiple criteria.">5"

Try COUNTIF

Count records in one region

=COUNTIF(C2:C6,"East")

Count records in one region. The result is checked against a separately authored expected value for the supplied table. You can edit the data to explore the rule.

Inspect the current formula

Read its written arguments or observe actual operation values in a separate local calculation. This action neither applies a draft nor grades an answer.

Read the formula, one argument at a time

Explore the written function calls and their inputs. The calculation result belongs to the complete formula.

COUNTIF · top-level call

=COUNTIF(C2:C6,"East")

1 / 2 · range

The cells to test against the criterion. Text labels are counted when they match. Blank cells and empty text follow the chosen criterion.

COUNTIF reference ↗

Follow the cells behind a result

Read explicit local references and helper formulas using a separate calculation. Your draft stays in this field; the worksheet and practice checks do not change.

The worksheet runs locally. Published checks apply to the supplied example only. Native Excel and Google Sheets compatibility remain unverified.

Reference and compatibility

Univer 1.0.4 / Apache-2.0. Calculation checks cover the supplied examples only. The browser worksheet does not implement every Excel feature, external service or connected data type.