Conditional Format cells with IF formula?

February 24, 2012 at 11:37:36
Specs: Windows 7
I am looking to set up conditional formating on an excel model so that any cell that does not contain an "If" formula within a certain range is highlighted in a different color. I want to easily ve able to see where people have made manual adjustments to the model.
I am working on excel 2007

See More: Conditional Format cells with IF formula?

Report •


#1
February 24, 2012 at 12:43:11
You can not use Conditional Formatting in the manner you'd like.

A CF Rule must evaluate to either TRUE or FALSE, using standard Excel functions and/or operators.

Since there is no standard Excel function and/or operator to check whether a cell contains a specific type of formula, there's no way to set up CF rule to check whether a cell contains a specific type of formula.

You could do it with VBA.

For example, this code will check A1:A10 and fill any cell that does not contain an IF function with the color green.

Sub If_Not_If()
 For rw = 1 To 10
  If Left(Cells(rw, "A").Formula, 3) <> "=IF" Then
   Cells(rw, "A").Interior.ColorIndex = 4
  End If
 Next
End Sub

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •
Related Solutions


Ask Question