Share via

formatting cells based on value comparison to another cell in the same row

Anonymous
2022-03-22T19:33:34+00:00

Hi,
I am using Microsoft® Excel® for Microsoft 365 MSO (Version 2202 Build 16.0.14931.20128) 64-bit. I have a worksheet on which column A and column B contain numerical values. In some rows, the value in column B is equal to the value in column A. In other rows, the values in the two columns are different. If possible, I'd like to highlight all cells in column B for which the value is different than the column A value in the same row. Ideally, I would like to change the fill color for these cells to yellow. It seems like I might be able to do this using conditional formatting, but I have not been able to figure out how to do it.

If anyone can tell me if this is possible and give me a clue how I might be able to accomplish this, I would greatly appreciate it.

Thanks in advance,
Paul

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

  1. HansV 462.6K Reputation points MVP Volunteer Moderator
    2022-03-22T19:51:48+00:00

    Let's say the data are in A2:B100 (with headers in A1:B1).

    Select this range. The active cell should be in row 2, i.e. either A2 or B2.

    On the Home tab, select Conditional Formatting > New Rule...

    Select 'Use a formula to determine which cells to format'.

    Enter the formula

    =$A2<>$B2

    Note the $ signs before the column letters. 2 is the row number of the active cell in the top row of the selection.

    Click Format...

    Activate the Fill tab.

    Select yellow.

    Click OK, then click OK again.

    10 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2022-03-22T21:34:29+00:00

    Thank you HansV - that worked perfectly !!

    1 person found this answer helpful.
    0 comments No comments