# Sum and count by color in Excel

Count and Sum by Color is a helpful Excel add-in that lets you calculate cells of the same fill or font color.

## Before you start

The tool can insert result as values or formulas created with custom Ablebits functions. To use the latter option, before running the add-in, go to the Ablebits Data tab, click Options and select Enable Ablebits functions:

After that, close and start Excel anew.

Note. Enabled Ablebits functions may adversely affect the add-in performance. If you are not planning to use any of the Ablebits functions, keep the option unselected.

## How to count colored cells in Excel

To quickly calculate color-coded cells, follow the steps below.

Note. Sum and Count by Color does not identify the format of the values in the cells. For example, if you have dates in your range, the tool will treat them as numbers.

### Start Sum by Color

1. Open the Excel worksheet where you need to count cells by color.
2. On the Ablebits Tool tab, in the Calculate group, click Sum by Color and select one of the two tools:

• Sum & Count by One Color
• Sum & Count by All Colors

### Sum and count by one color

Use Sum & Count by One Color to count cells or calculate values based on the selected color.

Select the options on the Count and Sum by Color pane:

1. By default, the add-in picks the entire data range in your Excel worksheet. You can change it by selecting the needed table or entering the range address manually.
2. Also, you can get the entire table selected automatically. For this, pick any cell in the table and click the Expand selection icon.
3. Click the Color Picker icon and select a cell that represents the background and/or font color you want to sum and count by.
4. Click the Calculate button and get the result on the add-in pane.
Note. If there are empty cells in your range, the tool will identify the font and fill colors that are set in the Format Cells option.
5. To see calculations by background color, go to the Background tab.
6. If you want to sum and count by font color, open the Font tab.
7. If needed, you can paste a single calculation result into your table: just hover over the needed function (SUM, COUNT, MAX, etc.) and click the Paste button. The add-in will ask you to pick a cell for the result:

Note. If you use this option, the numerical result will be pasted into your table without any text labels. For your convenience, the resulting cell will have the same font/background color as the original cells you calculated.
8. Select Insert result as formula and formulas will be created with custom Ablebits functions. You can learn more about them on the Ablebits functions page. The functions don't work for conditionally formatted cells and for ranges formatted as tables with colored alternate rows or columns.

Note. Formulas which are created with custom Ablebits functions recalculate only values and do not respond to color changes in cells.
9. To paste all results into your worksheet, click the Paste All... button and specify the top-left cell for the results.

For your convenience the results will have labels and the same font or background color as the cells you selected.

### Sum and count by all colors

This tool will give you a quick overview of color-coded data in your table. For example, if you use different hues to highlight prices from vendors, the utility will sum cells by color and show you the total for any group of numbers.

To count colored cells in Excel, open the worksheet with your data, run Sum and Count by All Colors, and select the options on the tool pane:

1. The add-in selects the entire data range in your worksheet automatically. You can change the range by entering the new address manually or selecting it in you sheet.
2. Also, you can get the entire table selected automatically. For this, pick any cell in the table and click the Expand selection icon.
3. When the range is chosen, click Calculate and see the results straight on the pane.
4. Select Background to see the result calculated by the cell's fill color.
5. Choose Font to total the selected values by their font color.
6. To calculate, pick from the functions in the dropdown list: Sum, Count, Counta, Countcolor, Average, Averagea, Averagecolor, Max, or Min.

Use the COUNTCOLOR function to get the total number of cells that have the same background or font color. Be aware that COUNT only counts cells containing numbers, COUNTA counts all cells that aren't empty. COUNTCOLOR counts all cells that have the appropriate font or background color regardless of the type of data the cells contain: text, numbers, or nothing:

Use the AVERAGECOLOR function to get the average of all cells that have the chosen background or font color, empty as well. While AVERAGE returns the average of cells with numeric values only, AVERAGEA finds the arithmetic mean of all cells that are not empty, including logical values and text representations of numbers. AVERAGECOLOR returns the average of all cells that have the chosen background/font color, whether they contain values or are empty:

7. Select Insert result as formula and formulas will be created with custom Ablebits functions. You can learn more about them on the Ablebits functions page. The functions don't work for conditionally formatted cells and for ranges formatted as tables with banded rows or columns.

Note. Formulas which are created with custom Ablebits functions recalculate only values and do not respond to color changes in cells.
8. To have the results pasted into your worksheet, click the Paste All... button and specify the top-left cell for the results. Once the location is chosen, click OK.

The results will have no text labels, but for your convenience they will have the same font or background color as the cells that were processed.

Responses

I need to count cells with color, without numerical value in the cells.

example: if the cells have red colors, then i can get the total of cells with red colors

Hello Raul,

Thank you for your comment. The total number of red cells (both with values and without them) will be displayed next to COUNTCOLOR on the add-in pane. If that is not what you need, please feel free to email us at support@ablebits.com. Any screenshots illustrating your task and the expected result will be appreciated in this case.

Hello...
can I sum all colored column in workbook, not just 1 work sheet? Thank you

Hello Diana,

Thank you for your question. Sorry, the add-in can sum colored cells only within 1 Excel worksheet. Thank you.

Dear All,

I try to download and very helpful, but after that my Whole PC auto format and lost all the document

Hello,

Thank you for your message. I have just replied to you by email.

I have discussed the issue you have faced with our technical specialists and would like to confirm that our Ultimate Suite works only when Excel is running and cannot be the cause of the problem.

Andrew Walker says:
June 26, 2020 at 11:37 pm

Have you implemented a way to have "sum by color" auto calculate when the cells are changed?

Andy

Hello Andrew,

Thank you for your comment. Sorry, this functionality is unavailable yet. The current version of the add-in pastes the result as a value, not a formula so if you need to recalculate it, you will have to run the add-in again.

The recalculate feature is in our developers' roadmap, but we cannot give any timing in its release yet. Sorry.

i have a file that has colored rows (same color) while some of the rows are not colored, i would like to know the formula to know how many rows has the color

Hello Usman,

Thank you for your comment. Our Count and Sum by Color tool will count the colored cells, not rows. As a workaround, you may select one of the rows and count the colored cells there to find out the number of colored rows in your sheet.

If however, you want to know more about Excel formulas and functions, please have a look at our blog: https://www.ablebits.com/office-addins-blog/

How do I get it to re-calculate each time values are changed in the range?
And how do I copy this formula to each different column if I only want the sum of that column?

You see, the add-in returns the result as a value, not a formula. To recalculate everything, you will have to run the add-in anew.
Hence, for each new column, you will also have to select it and calculate the results separately.

I will forward these feature requests to our developers for further consideration.
I sincerely apologize for any inconvenience.

Dries Cronje says:
July 4, 2019 at 11:03 am

I want to sum all cells with background color yellow

Katerina Bespalaya (Ablebits Team) says:
July 5, 2019 at 10:43 am

Hello Dries,

If your task is only to sum the cells with the background colored in yellow, please note that our tool will perform all the calculations, but after that you can paste just the summing result in your table. See this part of the instructions above.

Count and Sum by Color comes as a part of our Ultimate Suite for Excel. You can install its fully functional trial version and test the tool out during 30 days for free. Here is the direct download link.

If you have any questions or need further assistance with the add-in, please email to support@ablebits.com.

I need the combination of what Alvin and Jeffrey said.
Can you say when this will be available?

Hi Maurice,
Thank you for the comment. We have looked into these requests, and we do not plan to implement such features yet. The thing is that these functionalities will require to have Ultimate Suite installed on all machines on which you open workbooks with such functions.
Thank you.

Hello Irina,

So what you're saying that if we buy the Ultimate Suite we will be able to Sum by Color as a formula within the workbook and not have to do it cell by cell?

If this is the case, please let us know, since it is a function that, I for one, am very interested in.

Cheers,

Hello Jose,

Our support team assistant has just replied to you via an email. Please check your Inbox for our email. Thank you.

In normal Excel formulae,
you can have the = button and insert the cells you need to calculate. So that even when the value in the cells selected changes, the = value will update according.
My issue now is that although the tool is great, it doesn't provide this flexibility. I am designing a spreadsheet with the goal of allowing my Finance manager to autonomously use the spreadsheet designed without any interference from me.
The calculation has to be done manually. Is there a way I can just insert the sum function and my finance dept can key-in the value and the = value automatically changes?

Hi Alvin J,
Thank you for your feedback on the Count and Sum by Color utility. I understand your task, but there is no such functionality in the tool to automatically recalculate colored cells. However, we will think of ways to implement it in our future releases.
Thank you.

Jeffrey Scott says:
February 2, 2019 at 3:48 pm

Ok I have columns with color data. I want to count the number of cells that are green, etc and put these totals at the bottom of the worksheet. I want this to be shown as a formula so that I do not have to write it for the over 100 columns of data.

Hi Jeffrey,
Thank you for your interest in our product. To my regret, the Count and Sum by Color tool does not paste the results of the calculations as formulas, only as values. But I want to thank you for this idea, we will think of ways to implement this feature in our future releases.

I want to be able to sum all cells adjacent to colored cell? Is that possible? So basically the colored cell tells me which cell to add from.

Hi, Matt,
Thank you for using the Count and Sum by Color utility.
The tool sums cells by color, so you can first color the cells you need to sum and then use the add-in. Unfortunately, there is no way to sum noncolored cells adjacent to colored ones with the help of Count and Sum by Color.
Thank you.

Have file with 501 rows and 87 rows - the sum by color tool seems to hang, the file closes abruptly and if reopen again get a message file locked by user even though file closed . on reopening get message that file is locked by user . I need to reboot to work on the original file

Hello,
Thank you for using Sum by Color and for your message. In order we could solve the problem you face, please contact the support team at support@ablebits.com and let us know the following information:
1. Please describe in detail the steps you take before your file closes, which actions do you perform?
2. Does this happen only when you use the Sum by Color tool?
3. Please make a screenshot of the message you get when you reopen the file.