42

I want to check if the values in one column are the same as values in another column. Whenever the values are not the same, I would like to change the color of these cells.

For example:

http://i60.tinypic.com/2ai203l.png

Column I, Column AA both have the value of a the first month in years from 1318 till 1500 "Arabic Calender" but I want to check which of these values doesn't match and color them with yellow for example.

In this case, both cells in row 3 should have a different color after the checking operation.

Is there a way to do this?

TooTone
  • 7,129
  • 5
  • 34
  • 60
user3381987
  • 449
  • 1
  • 4
  • 5

3 Answers3

63
  1. Select your range from cell A (or the whole columns by first selecting column A). Make sure that the 'lighter coloured' cell is A1 then go to conditional formatting, new rule:

    enter image description here

  2. Put the following formula and the choice of your formatting (notice that the 'lighter coloured' cell comes into play here, because it is being used in the formula):

    =$A1<>$B1
    

    enter image description here

  3. Then press OK and that should do it.

    enter image description here

Jerry
  • 70,495
  • 13
  • 100
  • 144
  • 3
    If you have trouble with this, make sure you leave off the `$` for the direction that will be changing. E.g. If you have column data, make sure you have a `$` only on the column (`$A1`, not `$A$1`). – Jonathon Reinhart Oct 25 '18 at 20:42
5

you could try this:

I have these two columns (column "A" and column "B"). I want to color them when the values between cells in the same row mismatch.

Follow these steps:

  1. Select the elements in column "A" (excluding A1);

  2. Click on "Conditional formatting -> New Rule -> Use a formula to determine which cells to format";

  3. Insert the following formula: =IF(A2<>B2;1;0);

  4. Select the format options and click "OK";

  5. Select the elements in column "B" (excluding B1) and repeat the steps from 2 to 4.

TooTone
  • 7,129
  • 5
  • 34
  • 60
Federico
  • 53
  • 1
  • 2
  • this is helpful but the `;` in the formula can be replaced with `,`. Also the `IF` is unnecessary: see the accepted answer. – TooTone Nov 25 '16 at 12:03
  • This is the correct answer for Office 2016 - you need the "if" formula. – Russ Aug 25 '23 at 12:39
4

In my case I had to compare column E and I.

I used conditional formatting with new rule. Formula was "=IF($E1<>$I1,1,0)" for highlights in orange and "=IF($E1=$I1,1,0)" to highlight in green.

Next problem is how many columns you want to highlight. If you open Conditional Formatting Rules Manager you can edit for each rule domain of applicability: Check "Applies to"

In my case I used "=$E:$E,$I:$I" for both rules so I highlight only two columns for differences - column I and column E.

aprodan
  • 559
  • 5
  • 17