Professional Documents
Culture Documents
Background Color
Few weeks back, one of my regular visitors dropped me
an email describing an issue that he was facing. His task
was to add the contents of certain cells based on their
background colors.
To make the task more clear lets have a look at the below
image.
This image depicts that here we dont need the total sum
of all the elements but instead we want the sum of
elements that have the same background color.
So, for this task we can use a small user defined function
(UDF) which will do the trick for us.
4. Now, add one column next to the range that you wish
to sum up. In this new column enter the formula as:
=ColorIndex(<refrence_ofcell_whose_background_colour_index_you_wish_know>)
5. After that, drag this formula to the whole range.
6. Now, you can use the SUMIF function to add the cells
that have same background color as shown in the above
image.
=SumByColor(<cell_with_background_color_that_you_wish_sum>,
<Range_to_be_summed_up>)