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.
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.
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…