Reputation: 63
I'm being dumb here. I don't know what I'm forgetting.
I have two tables on two sheets with similar structures. I would like to have the following conditional formatting rules: -
The tables are sorted differently so I can't do a simple cell=cell comparison. I tried using the MATCH function, i.e. MATCH(blah)=0, but that didn't seem to do anything. I will eventually like to do this in VBA, but for now I just want to get the formulas correct and then I can write the code.
Basic example data below: -
Table1
Column1 | Column2 | Column3 | Column4 | Column5 |
---|---|---|---|---|
asd | 1qa | abc | Yes | blah |
qwe | 2ws | xyz | No | foo |
zxc | 3ed | def | Yes | blah |
qwe | 4rf | ghi | Yes | foo |
asd | 2ws | ghi | Yes | blah |
rty | 2ws | abc | No | foo |
Table2
Column1 | Column2 | Column3 | Column4 |
---|---|---|---|
asd | 1qa | abc | No |
qwe | 2ws | xyz | No |
asd | 2ws | ghi | Yes |
rty | 2ws | abc | Yes |
Thanks in advance.
Upvotes: 1
Views: 190
Reputation: 34245
For the first part of the question, you can use Countifs (or Match if you prefer) but must use Indirect for each table reference:
=COUNTIFS(INDIRECT("Table2[Column1]"),INDIRECT("Table1[@Column1]"),INDIRECT("Table2[Column2]"),INDIRECT("Table1[@Column2]"),INDIRECT("Table2[Column3]"),INDIRECT("Table1[@Column3]"))=0
Similarly the second part formula would be
=COUNTIFS(INDIRECT("Table2[Column1]"),INDIRECT("Table1[@Column1]"),INDIRECT("Table2[Column2]"),INDIRECT("Table1[@Column2]"),INDIRECT("Table2[Column3]"),INDIRECT("Table1[@Column3]"),INDIRECT("Table2[Column4]"),"<>"&INDIRECT("Table1[@Column4]"))>0
EDIT
This is a bit tedious, but you can avoid the indirect by defining the structured references in the name manager (mentioned briefly here)
e.g.
T1C1R2 is defined as
Table1[@Column1]
and T2C1 is defined as
Table2[Column1]
so the first formula becomes
=COUNTIFS(T2C1,T1C1R2,T2C2,T1C2R2,T2C3,T1C3R2)=0
Upvotes: 2