## How to Sum by Color in Excel? (2 Useful Methods)

Top 2 Methods to Sum by Colors in Excel are as follows –

- Usage of SUBTOTAL formula in excel and filter by color function.
- Applying GET.CELL formula by defining the name in the formula tab and applying the SUMIF formula in excel to summarize the values by color codes.

Let us discuss each of them in detail –

### #1 – Sum by Color using Subtotal Function

To understand the approach for calculating the sum of values by background colors let us consider the below data table which provides details of amounts in US$’s by region and month.

**Step 1:**Suppose we would like to highlight those cells which are negative in values for indication purpose, this can be achieved by either applying conditional formatting or by highlighting the cells manually as shown below.

**Step 2:**Now to achieve the sum of cells that are colored in excel, enter the formula for SUBTOTAL below the data table. The syntax for the**SUBTOTAL**formula is shown below.

The formula that is entered to calculate the summation is

**=SUBTOTAL(9,D2:D13)**

Here number ‘9’ in the function_num argument refers to **sum** functionality and the reference argument is given as the range of cells to be computed. Below is the screenshot for the same.

**Step 3:**As seen in the above screenshot, a summation of the USD amount has been calculated. In order to compute the amounts highlighted in a light red background color. Apply filter to the data table by going to Data then selecting a filter.

**Step 4:**Then select filter by color and choose the light red cell color under ‘Filter by cell color’. Below is the screenshot to better describe the filter.

**Step 5:**Once the excel filter has been applied, the data table will be filtered for only light red background cells and the subtotal formula applied at the bottom of the data table would display the summation of the colored cells which are filtered as shown below.

As shown in the above screenshot the computation of the colored cell is achieved in cell E17, subtotal formula.

### #2 – Sum by Color using Get.Cell Function

The second approach is explained to arrive at the sum of the color cells in excel is discussed in the below example. Consider the data table to better understand the methodology.

**Step 1:**Now let us highlight the list of cells in the USD Amount column which we are willing to arrive at the desired sum of colored cells as shown below.

**Step 2:**As we can see in the above screenshot, unlike in the first example here we have multiple colors. Thereby we will be using the formula**=GET.CELL**by defining it within the name box and not directly using it in excel.**Step 3:**Now once the dialog box for the ‘Define Name’ pops up, enter the Name and the formula for**GET.CELL**in ‘Refer to’ as shown in the below screenshot.

As seen in the above screenshot, the Name entered for the function is ‘CellColor’ and the formula =GET.CELL(38,’Example 2!$D2) is to be entered in ‘Refers to’. Within the formula, the numeric 38 refers to the cell code information and the second argument is the cell number D2 refers to the reference cell. Now click **OK.**

**Step 4:**Now enter the function Name**‘CellColor’**in the cell beside the color-coded cell which was defined in the dialog box as explained in step 3.

As can be seen in the above screenshot, the function **‘CellColor’** is entered which returns the color code for the background cell color.

Similarly, the formula is dragged for the entire column.

**Step 5:**Now to arrive at the sum of the values by colors in excel, we will be entering the SUMIF formula. The syntax for SUMIF formula is as follows:-

As can be seen from the above screenshot, the following arguments are entered into the SUMIF formula:-

- The range argument is entered for cell range E2: E13
- The criteria are entered as G2 who’s summarized values are needed to be retrieved.
- The range of cells is entered to be D2: D13

The SUMIF formula is dragged down for all the color code numbers for which values are to be added together.

**Things to Remember**

- While using the approach by SUBTOTAL formula, this functionality allows the users to filter for only one filter color at a time. Moreover, this functionality can be used to add only one column of values by filter colors. If there is more than one column with different colors by rows in the different column the SUBTOTAL may only show the correct result for one filter by color to a specific column only.
- The GET.CELL formula in combination with the SUMIF approach eliminates this limitation, as this functionality could be used to summarize by colors for multiple color codes in the cell background.

### Recommended Articles

This has been a guide to Sum by Color in Excel. Here we discuss how to find Sum by Colors in excel using 1) Subtotal Function and 2) Get. Cell along with practical examples and downloadable excel template. You may learn more about excel from the following articles –

- 35+ Courses
- 120+ Hours
- Full Lifetime Access
- Certificate of Completion