Conditionally format Table columns based on the Column Header value (using structured references)

diversification

New Member
Joined
Jun 24, 2020
Messages
38
Office Version
  1. 365
Platform
  1. Windows
Hi there, I've got a Table (let's call it Table1) with a number of 'spacer' columns in it. Those spacer columns each have the word "spacer" somewhere in their column headers. For example, a header might be "Spacer Column 3" or "SPACER66" and so on. I want to conditionally format all the spacer columns so that they're blacked out.

I know structured references can be used with conditional formatting by way of the INDIRECT function, however I'm having a difficult time figuring out how to even reference the column header of a specific cell using a structured reference. If I could do that, I could then search the header for "Spacer", and combine that with the indirect function to format entire columns whose headers contain the word "spacer."

I was really hoping that
Excel Formula:
=Table1[@Headers]
would spit out the header text, but it doesn't. Does anyone know of a way to do this? For the record, if that function did work, I'd then use something like
Excel Formula:
=SEARCH("SPACER",INDIRECT("Table1[@Headers]"))>0
to handle the conditional formatting I mentioned.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Why not just use
Excel Formula:
=ISNUMBER(SEARCH("spacer",A$1))
where A1 is the first 1st header in your table.
 
Upvote 0
Solution
Why not just use
Excel Formula:
=ISNUMBER(SEARCH("spacer",A$1))
where A1 is the first 1st header in your table.
Unfortunately, the Row location of the headers is variable. I should've mentioned that's one of the reasons why I'm interested in using the structured reference method.
 
Upvote 0
Once you setup the rule, then it will follow the table if it's moved.
Good point - that's probably good enough. I do hope that in a future release they provide a way to do this using a structured reference to make it even more bullet proof. That and allowing structured references naturally in conditional formatting rules. Wishful thinking maybe, but a guy can hope! Marked as answered. Thank you.
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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