Conditional Formatting for everything BUT one word

rhowse8

New Member
Joined
Jan 22, 2016
Messages
1
All,

Is there a way to color cells based on a value that is not contained? For my application any cell that doesn't contain the word "complete" would be yellow and every cell that does contain the word "complete" would be green. I know how to format the cells to turn green when complete is written, however, I am having trouble finding a way to format the other cells.

Anyone know how to solve this? I have tried using conditional formatting and can't see to get it right.

Thanks,

rhowse8
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
If you know how to set up Conditional Formatting for the green cells, then do the same thing for the yellow cells using this function:

=ISERROR(SEARCH("complete",F1))

where F1 is the upper left corner of your selection.
 
Upvote 0
first format background color yellow in all cells with data in that column
next apply conditional formatting to that same range of cells (if "complete" color green.

In code (assuming data starts in cel A1)
paste it in the codepage of the sheet where the formatting takes place.

Code:
Option Explicit

Sub colorStatus()
   Dim statRng As Range
   
   Set statRng = Me.Range("A1", "A" & Me.Cells(Rows.Count, 1).End(xlUp).Row)
   statRng.Interior.Color = RGB(255, 255, 0)
   
   statRng.FormatConditions.Add Type:=xlTextString, String:="complete", _
        TextOperator:=xlContains
   
   statRng.FormatConditions(statRng.FormatConditions.Count).SetFirstPriority
   
   With statRng.FormatConditions(1).Interior
      .PatternColorIndex = xlAutomatic
      .Color = 5296274
      .TintAndShade = 0
   End With

End Sub
 
Upvote 0

Forum statistics

Threads
1,215,635
Messages
6,125,942
Members
449,275
Latest member
jacob_mcbride

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top