Conditional Formatting based on comparing cell references


Hi All,


I have a rate spread sheet (below) that has 7 columns:


1Cost DescrCost AmountRate AppliedRate FactorCurrent Rate
(light green)
Live Rate
(light golden)
Hist. Rate
(light blue)

I want to be able to set conditional formatting on column D where it changes the fill color based on its reference: if I reference D2 to the live rate (F2), its fill color will change to light golden, the rest goes respectively or reference D3 to the current rate (E3), the fill color of cell D3 should become light green. I use different rates for different costs. I want the user to visually see what rate is applied to certain cost.


Please note that the condition must be based on the actual reference and not the values because sometimes the values of multiple rates may be identical. 


I tried to come up with a formula that compares the cell contents in cell D2 to the address of cell F2 but couldn't get it to work.


Expected result - column D




Any idea?


Thanks in advance.

10 Replies
Hello, would you mind uploading your file so I can use it to add the things you need there and then I can upload the solution?


@ricardojose  here you go. Thanks

@alex_n , here you go!


Ricardo, thanks for trying. But your solution is based on the value and not the actual cell reference. The reason behind me wanting it based on the cell reference is because sometimes the rates can be identical (ex. Current rate can be identical to the Historical rate) and it may cause bug in the result. Thanks.

The pseudo example would be as follows:
if (the content of D2 is "=E2", then format D2 cell fill to light green color)
D2: Rate Factor
E2: Current Rate (light green color column)

I tried to use Indirect() function with combination of Address() function but could not get it to the level it would work. I may be doing something wrong here.

Maybe you will need to reconceptualize the solution to work as needed. The only thing I can think of to achieve that and I know is possible is through macros. Are you allowed to convert that file into a macro-enabled workbook?


See the attached version.

Hans, thank you. Your solution is value-based as well. The way I see, a cell reference-based solution would help here.
best response confirmed by alex_n (Contributor)


OK, try this.

Hans, this one works as expected. Thank you very much!