The short answer is, you can't!
Where you can enter a formula and determine if a cell contains a certain
value, there is no forumla that can do a similar thing for a certain
format.
However, all is not lost. Help is on the way! This is a
User Define Function (UDF) that can return a string, reflecting the cell interior color for the colors Red, Blue, Green, Yellow, White, Black, Magenta & Cyan.
Paste it in a
Module. It would be good to put it in your PERSONAL.XLS workbook. Then, use it like any other function on your worksheet like this...
[tt][highlight yellow]
=IF(WhatInteriorColor(A1)="Red","I got RED!","nada")
[/highlight][/tt]
Code:
[blue]
Function WhatInteriorColor(rng As Range) As String
'Skip Metzger - 2007 May 29
'this function returns the color of the interior of a given cell
'
Select Case rng.Interior.Color
Case vbBlack
WhatInteriorColor = "Black"
Case vbRed
WhatInteriorColor = "Red"
Case vbGreen
WhatInteriorColor = "Green"
Case vbYellow
WhatInteriorColor = "Yellow"
Case vbBlue
WhatInteriorColor = "Blue"
Case vbMagenta
WhatInteriorColor = "Magenta"
Case vbCyan
WhatInteriorColor = "Cyan"
Case Else
Select Case rng.Interior.ColorIndex
Case 2
WhatInteriorColor = "White"
Case xlColorIndexNone
WhatInteriorColor = "None"
Case Else
WhatInteriorColor = "Other"
End Select
End Select
End Function
[/blue]