Change cell color based on other cell value

10

1

I have encountered numerous questions related to changing a cell color based on its value, which can be achieve easily with Excel "Conditional Formatting". However I'm interested in changing a cell color based on some other cell value.

For example, I want cell A4 to be painted red only if cell B4 has a greater value than A4 cell. Is there any way to accomplish that?

I've found this guide which actually explains what I need pretty well, but how can I expand this formatting to numerous cells? Just dragging doesn't work here for me.

EDIT: I'm using the Excel 2007 version.

Eugene S

Posted 2012-06-28T16:38:12.977

Reputation: 2 088

Answers

13

Conditional formatting in Excel 2007 (based on value of another cell)

  1. Select the cell you want to format, “A1″ in this example.
  2. In the Home tab, Styles group, click on Conditional Formatting.
  3. Select New Rule.

    enter image description here

  4. The New Formatting Rule window will open.

    enter image description here

  5. Click Use a formula to determine which cells to format.

  6. The New Formatting Rule window will now look like this:

    enter image description here

  7. In the edit box labeled “Format values where this formula is true“, enter “=” followed by a formula referencing the other cell. In this example the formula: “=B1<0″ is entered.

  8. Click the Format button. The Format Cells window will open.

    enter image description here

  9. Specify the formatting you want. In this example I changed the cell color to “RED”.

  10. Click OK to close The Format Cells window.

  11. Click OK to close The New Formatting Rule window.

To summarize this example: cell A1 will have a RED color when cell B1 value is less than zero.

Diogo

Posted 2012-06-28T16:38:12.977

Reputation: 28 202

Thank you for your answer. However it seems that these directives are for older version of Excel. I use 2007 version and I can't perform these steps directly. I will update my question with Excel version. – Eugene S – 2012-06-28T16:58:12.077

1@EugeneS changed to Excel 2007 – Diogo – 2012-06-28T17:17:31.217

Thank you for your effort! Can you just please add an instruction as to how can I expand this conditional formatting to multiple cells? For example I want cells A1 to A5 be dependent on cells B1 to B5 respectively. – Eugene S – 2012-06-28T17:26:02.353

I don't know exactly what you intend to do on this dependency, but if it is the same, just select a range on step 1. Or even copy and paste the entire cell to the folowing one. – Diogo – 2012-06-28T17:31:46.147

Choosing a range of cells won't help here since this formatting applies for each individual cell only. You can see that in Step 6 I have to show explicitly which specific cell I want to format. What I want is just that cell A1 format will be dependent on cell B1, cell A2 format will be dependent on cell B2 and so on... – Eugene S – 2012-06-28T17:36:00.780

2Just use the + drag icon and drop until the row that you want after applying the rule... I just this it here and it worked for me.. – Diogo – 2012-06-28T17:47:25.160

@Eugene Diogo's instructions are already very straightforward. You can drag the cells or use Paste Special > Format OR go to Manage Rules and just adjust the range in the Applies To field to cover cells A2 to A5. – Ellesa – 2012-06-29T02:25:27.257

1The dragging option to expand wouldn't be feasible for the example given in the question. As A1 contains a value to be compared to B1, dragging A1 will also change the value of cells A2:A5 not just the formattting. You can choose a range, Eugene, (at step 1 in Diogo's instructions) - when you do that in conditional formatting the formula you use applies to the first cell (top left) in the range and the formula implicitly adjusts for each cell in the range in the same way that a formula would change if it were in a worksheet cell and you dragged it...... – barry houdini – 2012-06-29T11:41:37.453