Hi,
You can do it with a UDF.
Alt +F11 to open
VB editor. Right click 'This Workbook' and insert module
and paste the code below in. The code is easy to update to addd extra colours
and if you not sure what the numbers are record a macro of yourself colouring
cells and use the numbers to add additional cases.
Call with
=BackColour(A1)
Function BackColour(r As Range)
Select Case r.Interior.ColorIndex
Case Is = 6 'Yellow
BackColour = 1
Case Is = 5 'Blue
BackColour = 2
Case Is = 4 'Green
BackColour = 3
Case Is = 3 'red
BackColour = 4
Case Is = 53 'Brown
BackColour = 5
Case Else
BackColour = "Not Defined"
End Select
End Function
"Sebastian" wrote:
Hi, I am trying to use a conditional to get a value from another cell. i.e.
A1 background color is yellow. in B1 I would write something like
if(A1=yellow,1,0) to get a value 1 in the cell B1, or 2 for blue, etc...
Thank you for your help.