Conditional formatting for text not in a table column

gberg

Board Regular
Joined
Jul 16, 2014
Messages
205
Office Version
  1. 365
Platform
  1. Windows
I am trying to come up with a Conditional Formatting that highlights text that does not equal the one of the options from a table column.

The Conditional Formatting applies to $B:$36:$B$45 and I have this formula for the conditional formatting
Excel Formula:
=AND(ISNA(MATCH(B36,INDIRECT("TBL_Labor_Categories[CODE]"))),B36<>0)

It highlights issues in cell B36 but not in B37-B45

I would appreciate any help
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Would use 0 as third parameter of MATCH help? (exact match, table can be not sorted)

Excel Formula:
=AND(ISNA(MATCH(B36,INDIRECT("TBL_Labor_Categories[CODE]");0)),B36<>0)
 
Upvote 0
I get an error message when I put that in
1725627716453.png
 
Upvote 0
Whoops, you shall of course use comma as separator. In my local settingd I use semicolon, so this is what I wrote.

But it is:

Excel Formula:
=AND(ISNA(MATCH(B36,INDIRECT("TBL_Labor_Categories[CODE]"),0)),B36<>0)
 
Upvote 0
Solution
By the way, INDIRECT is not only way as workaround to refer to table column in conditional formatting.
Probably better way (I think) would be by creating a name, and referring to that name in CF rule,
so the rule would be something like:
Excel Formula:
=AND(ISNA(MATCH(B36,TBL_Labor_Categories_CODE,0)),B36<>0)
where TBL_Labor_Categories_CODE is a name for TBL_Labor_Categories[CODE]

In names referring to structured address (like column in table) is perfectly fine.

See the screenshot
1725628265711.png
 
Upvote 0
Thanks for the additional advice. I've heard that INDIRECT is a volatile function. Would your suggestion make the spreadsheet work better (faster)?
 
Upvote 0
I had a couple of other items with the INDIRECT and used your advice on those as well. Thanks again!
 
Upvote 0
Indeed, volatile functions can make workbook react slower, as they are recalculated always when the workbook recalculates (even if their arguments do not change).
If you have few of them, you will not notice this performance decrease, but when they are used often in a large workbook - yes, you will see the influence.
Using non-volatile approach is (I think) quite commonly perceived as "elegant way" to build a workbook.

But the idea of limiting volatile functions usage is just a suggestion, not a strict rule.

Have a good day!
 
Upvote 0

Forum statistics

Threads
1,223,705
Messages
6,173,996
Members
452,542
Latest member
Bricklin

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