Google-sheets – Highlight two numbers if they are different

google sheets

So I have a sheet that requires me to confirm if two numbers in different columns are the same and would highlight them if they are different. The two numbers are always One row and column apart, so D4 and C3 or D5 and C4.

I'm not sure how to write a script to check to make sure both numbers are the same.

Best Answer

You don't need a script, conditional formatting will do. Having selected the range C2:D (for example), apply to it the rule "custom formula is..." =$C2<>$D2.

Here the reference to columns is absolute, but the row number is relative; so, in every row both C and D will be highlighted if unequal.