Results 1 to 2 of 2

Thread: Color match formula

  1. #1

    Question Color match formula



    Register for a FREE account, and/
    or Log in to avoid these ads!

    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.

  2. #2
    Super Moderator NBVC's Avatar
    Join Date
    May 2011
    Location
    Mississauga, Canada
    Posts
    1,489
    Articles
    0
    Excel Version
    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •