Conditional formatting - Or statement for 10+ different text words

jlugo

Board Regular
Joined
Aug 12, 2011
Messages
146
Hi

I've created a food journal and I want certain words to highlight in red that are junk food.
So far, I've been creating them individually, but would rather do one long condition to include all the text words that I want.

So if the cell value is = milk, soda, fries, pizza, beer, chips, candy, alcohol, mcdonalds, wendys, burger king etc. then it highlights in red.

Is is possible to add all these text into a multiple criteria OR statement?
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I've done projects that used multiple criteria for conditional formatting. What worked best for me was to create a junk food table somewhere (maybe a junkfood worksheet). Then you can reference that table in your conditional formatting. If the food item in question appears in the table, then the cell appears red.

since I wasn't able to reference other worksheets within the conditional formatting, I would create a helper/trigger collumn somewhere. If your food item was in cell B10: in cell AA10 I would enter =If(countif(junkfood!$A$1:$A$100,B10)>0,1,0)

Conditional format: =aa10=1

The advantage I've found is that I can add, delete or edit the items in the table without having to mess around with the conditional formatting.
 
Upvote 0
You could shorten that to...
=countif(junkfood!$A$1:$A$100,B10)>0

CF works only on TRUE/FALSE so if found, it will give >0 which is TRUE

Or you could use =MATCH(B10,junkfood!$A$1:$A$100,0)
 
Upvote 0
Great suggestions and I agree with your solutions. I've seen this done before and didn't think of it. Makes sense. Thank you.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,876
Members
452,363
Latest member
merico17

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