Count Colored Cells in Excel (Table of Contents)
Introduction to Count Colored Cells in Excel
We all are well aware of the fact that COUNT and COUNTIF functions are the ones that can be used to count the cells with numbers and cells that follow any specific criteria. Isn’t it being fancy to have a function which counts the colored cells? I mean something that counts different cells based on their color? Unfortunately, there is no such function directly available in Excel. However, we can use a combination of different functions to achieve the same. Thanks to the versatility of Microsoft Excel. Therefore, here are the methods using which we can count the number of colored cells in Excel.
- Using SUBTOTAL formula and color filters.
- Using COUNTIF and GET.CELL to count colored cells.
How to Count Colored Cells in Excel?
Let’s understand how to Count Colored Cells in Excel with a few examples.
Example #1 – Using SUBTOTAL Formula and Color Filters
Suppose we have data of 1000 colored rows as shown below, and all we wanted is to find out the count of each color within the entire data. See the partial layout of the data given below:
Step 1: Go to cell F1002 to use the SUBTOTAL formula to capture the subtotal.
Step 2: Start typing the formula for SUBTOTAL inside the cell F1002. This formula has several function options within it. You can see the list as soon as the formula is active.
Step 3: Out of the list, you need to select function number 102 associated with the COUNT function. Use the mouse to drag towards function 102 and double click it to select.
Step 4: Use cells F1 to F10001 as a reference array within which the function COUNT will be used to count the cells. Fix the cell reference with the dollar sign, as shown in the screenshot below.
Step 5: Close the parentheses to complete the formula and press Enter key to see the output. You can see 1000 as a number in cell F1002.
Step 6: Now apply a filter to the entire data and use the Filter by Cell Color option to filter the data with cell colors. As soon as you filter a specific color, the value of the cell F1002 will change to the number of cells that are with that specific color. See the screenshots below.
You can see there are 419 cells which have the same color as filtered, i.e. light orange. You similarly can check the count of other colors as well.
This works fine because of the use of the COUNT function (102) within the SUBTOTAL as an argument. The COUNT function counts all the non-empty cells within the given range, and subtotal gives the total of the counts. If we apply a filter with any specific criteria, due to the nature of SUBTOTAL, we only get the total count associated with those criteria (in this case, color).
Example #2 – Using COUNTIF and GET.CELL
We can also use the COUNTIF and a GET.CELL function in combination to get the count of colored cells. GET.CELL is an old macro function which does not work with most of the functions. However, it has compatibility with named ranges. This function can extract the extra piece of information which a normal CELL function could not extract. We use this function to get information about the color of a cell. Follow the steps to know how we can count the cells with color using these two functions.
Step 1: Create a new named range ColorCode using the named ranges option within the Formulas tab.
Go to Formulas tab > inside Defined Names section, click on Define Name to be able to create a named range.
Step 2: A pop-up box with “New Name” will appear. Mention the name as ColorCode and within Refers to: section, use the formula as =GET.CELL(38,’Example #2′!$A2). Press OK after the amendments. Your named range will be completed and ready to use.
38 here is an operation number associated with GET.CELL. It is associated with an operation that captures the unique color numbers in Excel.
Rename column G as ColorCode, where we will capture the numeric codes associated with each color. These codes are unique for each color.
Step 3: In cell G2, start typing =ColorCode. This is the named range which we have just created in the previous step. Press Enter key to get a unique numeric code associated with the color of cell A2 (remember, while defining the named range, we used A2 as a reference from a sheet).
40 is the code associated with pink color in Excel.
Step 4: Drag and paste the formula across cell G3:G1001, and you’ll see different numbers, which are nothing but the color codes associated with each color. See the partial screenshot below.
Step 5: Now, we need to calculate what is the count of each color in the sheet. For this, we will use the COUNTIF function. Start typing =COUNTIF in cell B1003 of the given excel sheet.
Please note that we have colored the cell 1003:1006 with the colors we have used respectively in our example.
Step 6: Use column G as a range argument to this function and ColorCode named range as a criterion. Complete the formula by closing the parentheses and see the output in cell B1003.
After using the formula, the output is shown below.
Drag and paste this formula across the remaining cells and see the count of remaining colors.
In this article, we have seen the different methods which can be used to find out the count of colored cells. Let’s wrap the things with some points to be remembered.
Things to Remember About Count Colored Cells In Excel
- We don’t have any built-in function which can count the colored cells in the excel sheet. However, we can use a different combination of formulae to capture the same.
- The CELL function, which we use in the second example, gives more information related to a cell that the general CELL function can’t provide.
- Numeric code 102 we use under the SUBTOTAL function is a numeric code of COUNT function under it.
Recommended Articles
This is a guide to Count Colored Cells in Excel. Here we discuss How to use Count Colored Cells in Excel along with practical examples and a downloadable excel template. You can also go through our other suggested articles –
- Count Cells with Text in Excel
- Count Characters in Excel
- COUNTIFS in Excel
- How to Add Cells in Excel
23 Online Courses | 9 Hands-on Projects | 110+ Hours | Verifiable Certificate of Completion
4.9
View Course
Related Courses