ExcelUnpackUnpack Excel, one formula at a time.
Log inSign up

Lesson 20 · Count functions

COUNTIF with a cell in Excel

Instead of typing the value into the formula, point COUNTIF at a cell. Then you can change the cell and the count updates. For signs like >=, join the sign to the cell with &.

Practice this lesson →Pro lesson. The first 4 lessons are free.

What you will learn

  • Use a cell inside COUNTIF criteria
  • Join a comparison sign to a cell with &

How it works

To compare with a cell, join the sign and the cell with &: ">="&E1.

If you just want "equal to the cell", use the cell by itself: =COUNTIF(A2:A9,E6).

Formulas at a glance

=COUNTIF(A2:A9,">="&E1)at or above E1
=COUNTIF(A2:A9,E6)equal to E6

Example

Write the formula to count scores at or above the pass mark in E1.

ABCDE
1ScorePass mark70
285
362Passed
491Not passed
570
655Score to find85
785Equal to E6
878Higher than E6

Click E3 and type =COUNTIF(A2:A9,">="&E1), then press Enter.

The answer is 5.

When to use it

  • A count that changes when you type a new target
  • Counting scores at or above a pass mark in a cell
  • Building a small report people can change

Common mistakes

  • Writing ">=E1" in quotesThat looks for the text E1. Use ">="&E1.
  • Adding a sign when you mean equalFor "equal to", just use the cell: =COUNTIF(A2:A9,E6).
  • Not locking the range when copyingLock the range with $ if you copy the formula down.

Practice it on a real sheet

Reading is a start. Doing it is how it sticks. This lesson walks you through every click on a live spreadsheet and checks each answer.

COUNTIF with a cell in Excel: how it works, with examples · ExcelUnpack