Calculate based on the color of the cell

Closed
Report
-
Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
-
Hello,



I am trying to write an if formula in Excel 2007 that will calculate the sum of all the cells that are a certain color. Can you help me do this? For instance if the cell is green then I want to add all the green cells, yellow? add the yellow cells, red? add the red cells.

Can this be done?

Thank you!

Pam

1 reply

Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
803
you need a macro
see this webpage

http://www.cpearson.com/excel/colors.aspx

see this section

Function SumColor(TestRange As Range, SumRange As Range, _
ColorIndex As Long, Optional OfText As Boolean = False) As Variant