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.


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.

|improve this answer|||||
  • Is it possible to have it mark as True when the numerals are the same and False when they are different? – user129447 Jul 23 '16 at 4:04
  • If you want to have true or false recorded in another column, put the formula =arrayformula(C2:C=D2:D) there. – user79865 Jul 23 '16 at 4:11
  • Is it possible to do this with a script? – user129447 Jul 23 '16 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.