Although Excel doesn’t have a built-in feature to count cells by their colors, filtering cells by their color is possible. In this guide, we're going to show you how to count colored cells in Excel.

Download Workbook


  1. Right-click on a colored cell in the data. Make sure to select the cell with the color you want to count.
  2. Click Filter > Filter by Selected Cells Color to filter the colored cells.
  3. Type in the following formula =SUBTOTAL(103,<data range>) where <data range> is the reference of your data. It is B5:B18 in our example.
    How to count colored cells in Excel

How it works

The SUBTOTAL function can perform various aggregation operations with and without using manually hidden rows. In this example, Excel hides the rows with unwanted values when the filtering is applied. Thus, the filtered-out values remain in manually hidden rows. The SUBTOTAL function can exclude the values in the hidden rows. As a result, it can return the number of colored cells.

The SUBTOTAL function supports the capabilities of both COUNT and COUNTA. The function type is determined by the first argument. Choose either 102 or 103 for COUNT and COUNTA functionalities respectively.

The second argument is the range where you want to count cells.


Using a table to count colored cells

You can use this method if you keep your data in an Excel Table (which we recommend). You can add a total row and select the function from a dropdown menu.

  1. After converting your data into a table and filtering by color, select any cell in the column you want to count.
  2. Enable the Total Row checkbox in Table Design tab in the Ribbon.
  3. Click on the number added to the last row.
  4. Click on the arrow to see the options. Select Count.

Excel automatically adds a formula with the SUBTOTAL function. You do not need to relocate formula thanks to the dynamic structure of Excel Tables.