Formualizer Docs

COUNTIF

Counts cells in a range that satisfy a single criterion.

COUNTIF evaluates each candidate cell against one criteria expression.

The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.

Syntax

=COUNTIF(range, criteria)

Arguments

ArgumentTypeRequiredDefault
rangeanyRequired—
criteriaanyRequired—

Differences from Excel

Formualizer accepts an array constant as the range. Excel requires a reference.

Remarks

  • An equality criterion for a date or number ("10/26/1999", "36459", 36459) also matches text cells holding that date; <> and ordering criteria do not read date text.
  • Criteria support numeric comparisons and wildcard text matching.
  • Matching is case-insensitive for text criteria.
  • Non-matching or blank cells are not counted.

Examples

Count records equal to a region label.

Formula =COUNTIF(A1:A4,"East")

Input cells
A
1"East"
2"West"
3"East"
4"Northeast"

Expected result 2

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Use a wildcard to include labels with the same ending.

Formula =COUNTIF(A1:A4,"*east")

Input cells
A
1"East"
2"West"
3"East"
4"Northeast"

Expected result 3

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

A criterion matching no cell produces a zero count.

Formula =COUNTIF(A1:A4,"South")

Input cells
A
1"East"
2"West"
3"East"
4"Northeast"

Expected result 0

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Count numbers greater than 10

Formula =COUNTIF(A1:A3, ">10")

Input cells
A
15
215
322

Expected result 2

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Date criterion matches date text

Formula =COUNTIF(A1:A3, "10/26/1999")

Input cells
A
1"10/26/1999"
2"1999-10-27"
336459

Expected result 2

This example uses behavior that differs in the published browser package.

FAQ

Is COUNTIF text matching case-sensitive?

No. Text criteria matching is case-insensitive.

Can COUNTIF evaluate wildcard criteria?

Yes. Criteria expressions support wildcard patterns for text.

Implementation

Engine source

On this page