Difficulty getting proper "not equal to" Logic into conditional formatting.

creaseA

New Member
Joined
Mar 20, 2023
Messages
18
Office Version
  1. 365
Platform
  1. Windows
Here is my goal. A cell (say A1) contains different strings, string1, string2, etc...... . A different cell has conditional formatting with the following logic such that, string1 and string2 are important, but all other strings are not.

"If A1 <> "string1" OR A1<> "string2", then grey out the cell...."

Ie if either string1 or string2 is present in A1, the cell should not be greyed out, otherwise the cell should be grey.

I have tried multiple logic statements none of which seem to have worked in the conditional formatting box "if this equation is true, do this"

One thing I tried to use was OR(A1<> "string1", A1 <> "string2") nut this did not work. Additionally, excel seems to add an equal sign and additional "" to strings that I input which I believe means am not inputing this correctly.

Any help or advice on logic would be greatly appreciated. Still relatively new to this type of work.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
You need to use and, not or
Excel Formula:
=AND(A1<>"string1", A1<>"string2")
 
Upvote 0
Solution
You need to use and, not or
Excel Formula:
=AND(A1<>"string1", A1<>"string2")
I thought this as well however when I input =AND(A1 <> "string1", A1<> "string2") into the conditional formatting rule, the cell remains greyed out no matter what string is passed into A1. Here is my actual input: =AND($J$25<>"Double Bevel", $J$25 <>"Double Vee")
 
Upvote 0
Did you select "use a formula" for the rule
 
Upvote 0
Did you select "use a formula" for the rule
Yes I ensured that I used a formula. So currently it should be setup that if that forumla is true it greys out the cell.

Thats why I'm confused that AND does not work since if either string1 or string2 were actually present, the AND would evaluate as False and no formatting would occur......
 
Upvote 0
In that case check that the contents of J25 are exactly the same as the strings, no typos or leading/trailing spaces.
 
Upvote 0
In that case check that the contents of J25 are exactly the same as the strings, no typos or leading/trailing spaces.
This was the issue. I have accidentally typed "string1 " instead of "string1"
 
Upvote 0
Glad it's sorted & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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