Using Logical OR on text in Conditional Formatting

D

Darius Poli

I have a column with various text entries. I have created a conditional formatting rule for each type of entry but the formatting can be grouped together, so I would like a Conditional Formatting rule that says

If string contains "foo" or "bar" then colour re
If string does not contain "yibble" or "wibble" then make bol
etc

Any idea how I can do this rather thasn having to manage over 30 rules with each one looking for a single text entry type

Thank

Darius
 
B

Bob Phillips

Try a formula of

=OR(A2="foo",A2="bar")

=AND(A2<>"yibble",A2<>"wibble")

HTH

Bob
 
M

Mike H

Hi,

CF rule for is there

=OR(ISNUMBER(SEARCH("Foo",A1)),ISNUMBER(SEARCH("Baa",A1)))

CF rule for both not there
=AND(NOT(ISNUMBER(SEARCH("Foo",A1))),NOT(ISNUMBER(SEARCH("Baa",A1))))

CF rule for only 1 there

=OR(NOT(ISNUMBER(SEARCH("Foo",A1))),NOT(ISNUMBER(SEARCH("Baa",A1))))

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.
 
D

Darius Poli

Thanks for the useful hints but I need a little more help I'm afraid

Column A contains a list of text items and I want to colour them based on the entry, for each entry, so I cannot use references to individual cells

I tried setting the CF as =OR($A$1:$A$nn="text",...) but that will format things based on the data in the entire column

What I want to say is, for any cell, if that cell has text "xxx", format one way, if it has text "yyy", format a different way. For a large range of cells with changing values

Thank

Darius
 
B

Bob Phillips

I think the formula that I gave you will work if you are looking at full
cell content, or Mike's formula if partial cell content. Just select all the
cells at the start.

HTH

Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top