Excel Guides

Counting Shaded Cells in Excel

To count the number of shaded cells in a worksheet, you can use the COUNTIF function. In the generic form of the formula (above), rng is the range of cells that you want to count, and criteria is the criteria for which cells to count. For example, if you wanted to count the number of shaded cells in A1:A100, you would use the following formula:


The <> operator is a logical operator that means "not equal to". So, this formula is saying to count all cells in A1:A100 that are not equal to an empty string (""). Since all shaded cells contain some sort of value, they will not be equal to an empty string and will therefore be counted.

If you only want to count cells that are shaded a certain color, you can use a different operator in the formula. The following table lists the operators that can be used for counting cells by color:

Move beyond 


Get started with Causal today.
Build models effortlessly, connect them directly to your data, and share them with interactive dashboards and beautiful visuals.
=Equal to
>=Greater than or equal to
<=Less than or equal to
>Greater than
< Less than