I don't know how to do exactly what you are asking, but are the different color set up by conditional formatting? If so, you could use an array formula to total them based on the same conditions?
?
Hi Karenlee
You would need a Custom Function for this, so here is one!
To use it Push Alt+F11 and go to Insert>Module and paste in this function:
Function FontClrFind(FontColor As Range, SearchRange As Range)
Dim clr As Integer, cell As Range, Found As Boolean
Application.Volatile
clr = FontColor.Font.ColorIndex
Set SearchRange = SearchRange.SpecialCells(xlCellTypeConstants)
Found = False
For Each cell In SearchRange
If cell.Font.ColorIndex = clr Then
Found = True
Exit For
End If
Next cell
FontClrFind = Found
End Function
Push Alt+Q to return to Excel and save.
Now push Shift+F3 and scroll down to "User Defined Functions" and select "FontClrFind" and click OK. To use your example you would use it like this:
=IF(FontClrFind(C1,B6),"J","L")
Where C1 contains a Font with the Color red.
B6 is then cell to check.
You can also use it to search a range of cells like:
=IF(FontClrFind(C1,B6:B200),"J","L")
If any cells font within the range B6:B200 is red the result will be "J" as the result would be true.
This type of formula will ONLY recalculate when Excel recalculates OR a cell Content within the range changes. The change of a font color within the range is not considered a change.
Dave
OzGrid Business Applications
If the colors are the result of conditional formatting, this is not a lame suggestion - it is a very good suggestion. The formula structure would be =IF(B6=[conditional format criteria],"J","L")
Celia
Celia is right, this is not a lame suggestion as
marks UDF will not work on conditionally formated
cells.
Ivan
Sorry that was Daves UDF.....
Yeah, it wasn't me. As a general rule I discourage
the use of color in worksheet logic. Color gradations
can be subtle, people are color blind, a different font
color can be applied to each character in a cell,
and powerful tools such as PivotTables don't
recognize color when used as a data attribute.