The COUNTIF function takes a range and a criteria.

In this case, we give COUNTIF a range equal to all rows in Sheet2.

Note: an easy way to enter this range is to use theSelect All button.

1000 first names on Sheet2

For criteria, we use a reference to C4, which contains “John”.

COUNTIF then returns 15, since there are 15 cells in Sheet2 equal to “John”.

Contains vs.

1000 first names on Sheet2

Doing so can cause major performance problems, since the range includes millions and millions of cells.

When possible, restrict the range to a sensible area.

COUNTIF can be used to count…

1000 first names on Sheet2

1000 first names on Sheet2

1000 first names on Sheet2

Excel formula: Search multiple worksheets for value

Excel formula: Count occurrences in entire workbook

Excel COUNTIF function

1000 first names on Sheet2