Explanation

The range B7:B9 contains the sheet names we want to include in the search.

The text “1:1048576” is a range that includes every row in the worksheet.

INDIRECT evaluates this text and returns a standard reference to every cell inSheet1.

Excel formula: Search entire worksheet for value

This goes into the COUNTIF function as the range.

Note: COUNTIF is not case-sensitive.

Contains vs.

Excel formula: Count occurrences in entire workbook

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

Volatile functions recalculate on every worksheet change, so the impact on performance can be huge.

When possible, restrict ranges to a sensible size.

Excel COUNTIF function

INDIRECT is useful when you want to assemble a text value that can be used as a valid reference.

Excel INDIRECT function