0Pricing
Excel Formulas Academy · Lesson

Counting by Criteria With COUNTIF

Count cells that satisfy one condition using COUNTIF.

Counting by Criteria With COUNTIF is a free Excel Formulas Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Excel Formulas Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

From Adding to Counting

SUMIF totals matching numbers. Sometimes you do not care about the total, you just want to know how many rows match a condition. How many sales were in the East region? How many scores were above 90?

That is the job of COUNTIF. It scans a range and counts every cell that satisfies your condition, ignoring the rest.

The COUNTIF Pattern

COUNTIF is simpler than SUMIF because it only needs two pieces:

  • range the cells to look through
  • criteria the condition each cell is tested against

There is no separate sum_range, because COUNTIF counts the matching cells in the same range it tests.

=COUNTIF(range, criteria)

Counting Text Matches

Suppose regions are listed in A2:A10. To find out how many rows are East, test that range for the word East wrapped in quotes.

The spreadsheet reads each cell and adds one to its tally every time it sees East. Just like SUMIF, text matching is not case sensitive.

=COUNTIF(A2:A10, "East")

Referencing the Criteria Cell

Hardcoding the word is fine, but pointing at a cell makes the formula flexible. If D1 holds a region name, count matches against D1.

Change D1 to West and the count updates immediately. This pairs nicely with a SUMIF in the next column so you can show both a total and a count for the same region.

=COUNTIF(A2:A10, D1)

Counting Numbers

COUNTIF works on numbers too. To count how many scores in B2:B10 are exactly 100, use the number itself as the criteria.

No quotes are needed around a plain number, although quotes would still work. Each cell equal to 100 adds one to the result.

=COUNTIF(B2:B10, 100)

Counting With Comparisons

The real power shows up with comparison operators inside quotes. To count scores greater than 90:

  • ">90" above 90
  • "<60" below 60
  • ">=70" 70 or higher

This formula tells you how many entries cleared the 90 mark, perfect for a pass or fail count.

=COUNTIF(B2:B10, ">90")

Operator Plus a Cell

To compare against a value stored in a cell, join the operator and the cell with an ampersand, exactly like SUMIF. If D1 holds a cutoff score, count everything at or above it.

The & stitches ">=" to the contents of D1, producing a live condition such as ">=70".

=COUNTIF(B2:B10, ">="&D1)

Counting Not-Equal-To

To count cells that are not a certain value, use the not-equal operator <>. This formula counts every region that is not East.

You can also count non-blank cells with "<>" alone, which matches any cell that has something in it. It is a quick way to see how many entries have been filled in.

=COUNTIF(A2:A10, "<>East")

Counting Blanks and Non-Blanks

Two handy patterns:

  • "" counts truly empty cells
  • "<>" counts cells that contain anything

This is useful for tracking progress, like how many tasks still have no status. Note that a cell with a space looks blank but is not, so clean your data if counts seem off.

=COUNTIF(A2:A10, "")

A Deeper Example: Frequency Table

COUNTIF shines when building a frequency summary. Put each unique region in cells D2, D3, D4, then write one COUNTIF that points at the label cell and fill it down.

Now each row shows how many times that region appears. Add a SUM under the counts and it should equal the number of data rows, a quick sanity check that nothing slipped through.

=COUNTIF(A:A, D2)

Finding Duplicates With COUNTIF

A clever use: spot duplicates. If you count how many times the value in A2 appears in the whole column and get more than one, it is a duplicate.

Wrap it in an IF to flag them: a result above 1 means the entry repeats. This is a popular trick for cleaning lists before analysis.

=IF(COUNTIF(A:A, A2)>1, "Duplicate", "Unique")

Quick Check

Test your understanding of comparison criteria in COUNTIF.

Recap: COUNTIF

You can now count rows that meet a condition with COUNTIF. Remember:

  • The pattern is just range, criteria with no sum_range.
  • Quotes wrap text and operator-based criteria like ">90".
  • Join an operator to a cell with &, as in ">="&D1.
  • Use it for frequency tables and to flag duplicates.

Next you will average only the matching values with AVERAGEIF.

=COUNTIF(A2:A10, "East")

Frequently asked questions

Is the “Counting by Criteria With COUNTIF” lesson free?

Yes — the full text of “Counting by Criteria With COUNTIF” is free to read here on the web, and the Excel Formulas Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Excel Formulas Academy course, upgrade to CoddyKit PRO.

What will I learn in “Counting by Criteria With COUNTIF”?

Count cells that satisfy one condition using COUNTIF. You practise Excel Formulas Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Excel Formulas Academy?

No prior experience is required. Excel Formulas Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Counting by Criteria With COUNTIF” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Excel Formulas Academy lesson?

Yes. Every Excel Formulas Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Summing by Criteria With SUMIF
  2. Counting by Criteria With COUNTIF
  3. Averaging by Criteria With AVERAGEIF
  4. Using Wildcards in Criteria
← Back to Excel Formulas Academy