This is an alternative to conditional formatting. The following will detect the colours Red, Yellow and Green in a particular cell. It will add the name of the colour – good for those colour blind individuals. It is a custom function so needs to used in conjunction with a formula or in a VBA procedure.
Function ColourofCell(rng As Range)
If rng.Interior.ColorIndex = 3 Then
ColourofCell = "Red"
ElseIf rng.Interior.ColorIndex = 6 Then
ColourofCell = "Yellow"
ElseIf rng.Interior.ColorIndex = 4 Then
ColourofCell = "Green"
Place the above in a regular VBA function and use in conjunction with a formula as follows.
Where A2 contains the cell with the colour of red, yellow or green. Any cell colour other than the 3 mentioned will display zero.
I have attached an Excel file to go with this post.