if based on cell formatting

M

Matt

Is it possible to use if statements based on cell formatting?
For example:
=if(cell is green,1,0)
 
B

Bob Phillips

Colour is not possible, you would need some VBA, such as

Function ColorIndex(rng As Range, Optional text as Boolean = False)
If text Then
ColorIndex = rng.Cells(1,1).Font.ColorIndex
Else
ColorIndex = rng.Cells(1,1).Interior.ColoRindex
End If
End Function

and in the worksheet use

=IF(ColorIndex(A1)=5,1,0)


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)
 
Top