• Status: Solved
• Priority: Medium
• Security: Public
• Views: 295

# A1 format red if column C & D do not match in every row

Leaving cell A1 blank.  Formula handled within the format formula section.

Thank you,
JP A1-red-if-C-and-D-rows-do-not-al.xlsx
0
easycapital
1 Solution

Commented:
Use the following conditional formatting rule

=SUMPRODUCT((C:C=D:D)*1)<>SUMPRODUCT((C:C=C:C)*1)

Thomas
0

Commented:
1.  Select the A cell of any row which you want to show the color.
(assuming that you selected row 4, i.e. cell A4, do the following.

2.  choose "Conditional Formatting" from "Format" menu

3. Select "Formula Is" in the condition dropdown list

4. Enter the following formula in the text field.
=OFFSET(A4,0,2)<>OFFSET(A4,0,3)

5. Click the format button and choose the format (Red)

6. OK and exit.

7. Copy cell A4 and select all the cells in the column A where you want to apply the formula.

8. Paste Special and choose "Format" only.

9. You are done.
0

Author Commented:
Excelente
0

Author Commented:
Sorry Santababy. I missed your solution.  Thank you for the feedback.
//JP
0

EngineerCommented:
=SUMPRODUCT(\$C\$4:\$C\$9-\$D\$4:\$D\$9)
0

Author Commented:
Nutsch, not sure why SUMPRODUCT((C:C=D:D) and not C:C=C:C.
Also, the multiplying by 1 is to ensure they are all treated as numbers?

ssagibh. not understanding how subtracting, ensures that every row is the identical.

Thanks,
Juan
0

EngineerCommented:
Does it work or does it not work?
0

Author Commented:
Yes it works.  I am just trying to understand the logic, as per my last comment.
0

EngineerCommented:
Actually this might work in most cases.

The value of false is zero and the value of true is 1. I played with this and if all the numbers are equal their difference would be zero and their sum would be zero.

This, however, may fail in cases where, for example, c4 is 4 and d4 is 3 and then c5 is 3 and d5 is 4 and all the rest are the same. In this case the difference in row 4 would be 1 and the difference in row 5 would be -1 and summing all up would again give zero.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.