Quick, clean, and to the point

Search entire worksheet for value

Excel formula: Search entire worksheet for value
Generic formula 

To search an entire worksheet for a value and return a count, you can use a formula based on the COUNTIF function.

In the example shown, the formula in C5 is:


The second sheet in the workbook, Sheet2, contains 1000 first names in the range B4:F203.

1000 first names on Sheet2

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 the Select 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. Equals

If you want to count all cells that contain the value in C4, instead of all cells equal to C4, add the wildcards to the criteria like this:


Now COUNTIF will count cells with the substring "John" anywhere in the cell.


In general, it's not a good practice to specify a range that includes all worksheet cells. 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.

Dave Bruns

Excel Formula Training

Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.

Download 100+ Important Excel Functions

Get over 100 Excel Functions you should know in one handy PDF.