16

I believe I am correct in saying that a reference to a column in a table (e.g. table1["col1"]) is known as a structured reference as opposed to an absolute reference (e.g. A1:A5).

I would like to know if it is possible to use structured references in a table. This post: Structured table references in conditional formatting formulas suggests that it is possible using INDIRECT()however I cannot figure out how to achieve what I need. I'll explain.

Take this contrived example:
enter image description here
This is a table. I would like the value in col2 to be coloured green if it is equal to the value in col1, and I'd like to use conditional formatting to do it. Essentially I want it to look like this:
enter image description here

I attempted to "Use a formula to determine which cells to format", the formula is =INDIRECT("Table1[col1]")=INDIRECT("Table1[col2]"):
enter image description here

But none of the cells changed their formatting.

Anyone know how to do this?

2
  • 2
    When there are multiple columns in the table one must use the full reference tblName[columnName] in their reference. Commented Jan 16, 2020 at 21:09
  • 1
    thanks @ScottCraner, I tried that but it still didn't work. I updated the post accordingly.
    – jamiet
    Commented Jan 16, 2020 at 21:16

2 Answers 2

23

Include the table name and add the @ symbol to reference row for row.

=INDIRECT("Table1[@col1]")=INDIRECT("Table1[@col2]")

enter image description here
    click for larger image

3
  • 3
    That works great, much better than having a specific column letter. Shame we can't just reference a column in the same table like [@[col1]] in conditional formatting. Commented Nov 17, 2020 at 10:22
  • This kind of formula =ISNUMBER(SEARCH(Table10[[#Data],[Process1]:[Process18]] & "_" & RIGHT(Table10[[#Headers],[Process1]:[Process18]],LEN(Table10[[#Headers],[Process1]:[Process18]])-7),Table10[[#Data],['#Experiment processes]])) works for me if I put it in some cell. But it doesn't work if I put it in the conditional formatting field! Why?!
    – 71GA
    Commented Jul 13, 2022 at 19:57
  • Is there a way to use a table name as a cell range?
    – Edmondo
    Commented Jul 27, 2022 at 18:02
-1

For me the following works: first cell of the column to be formatted is selected, then conditional formatting --> use a formula --> edit rule: put in table column to be formatted = column to compare to the first cell should be formatted now. Then I used format painter for the rest of the column, in your case Col2. it worked for me, hope it works for you as well. - Martijn

Disregard: After rechecking the effects, I noted the conditioning does not work.

1
  • 1
    Welcome to SuperUser! How is your answer better than the accepted one? If you don't have something substantial to add or the old answer is now outright dangerous, please do not answer questions that are this old. Commented Apr 19, 2023 at 7:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .