Color match formula

Abhishek Ghai

New member
Joined
Jul 7, 2012
Messages
5
Reaction score
0
Points
0
Hello,

My question is simple, Is it possible to have a color match formula, means if Cell A1 is in blue color and Cell B1 in White color then the result in C1 for matching the color should be False and vice versa if both the cells have same color then the result should be true. It is the same kind of concept we follow when the cells have same or different value but here there are no values but cells are colored. I hope I make sense.
 

NBVC

Super Moderator
Staff member
Joined
May 20, 2011
Messages
1,518
Reaction score
0
Points
0
Location
Mississauga, Canada
Excel Version(s)
Excel 2016
You can't do it with regular formulas, you will need a vba user defined function...

e.g. Hold the ALT key and press F11 to go into the VB Editor, then go to Insert|Module

Now paste the following code in the editor:

Code:
Function CellColor(Target As Range) As Variant
     CelllColor = Target.Interior.Color
End Function

Now in the sheet, you can use a formula like:

=CellColor(A1)=CellColor(B1)

the result should be TRUE if cell is same colour.

Note, that if you change colour afterward, the formula doesn't recalculate, you will need to force it by hitting F9 key.
 
Top