Excel: Can I create a Conditional Formula based on the Color of a Cell?

前端 未结 2 755
灰色年华
灰色年华 2020-12-24 03:51

I\'m a beginner and trying to create a formula that modifies the contents of Cell A1 based on the color of the cell in B2;

If Cell B2 = [the color red] then display

2条回答
  •  一个人的身影
    2020-12-24 04:11

    You can use this function (I found it here: http://excelribbon.tips.net/T010780_Colors_in_an_IF_Function.html):

    Function GetFillColor(Rng As Range) As Long
        GetFillColor = Rng.Interior.ColorIndex
    End Function
    

    Here is an explanation, how to create user-defined functions: http://www.wikihow.com/Create-a-User-Defined-Function-in-Microsoft-Excel

    In your worksheet, you can use the following: =GetFillColor(B5)

提交回复
热议问题