10
votes

I am trying to create a formula in Microsoft Excel 2010 to accomplish the following algorithm:

If A1=10, then A2 has a background color of red.

I have basic knowledge of if/then statements in Excel, so I have this so far:

=IF(A1=10, x)

...where x would be the formula for changing the background color of the cell. However, after conducting some internet research on the subject, the consensus seems to be that I should instead use conditional formatting to accomplish this task. I have never used conditional formatting and am having trouble understanding how to utilize it so that a condition on one cell would affect another cell.

This is the conditional formatting screen that I am faced with:

Conditional box

So I guess I have two questions:

  1. Is using conditional formatting the best way to accomplish this?
  2. If so, how can I utilize it to assign a background color to a cell, given the truth of a condition on a different cell?
1

1 Answers

12
votes

You can do it using conditional formatting, so you're on the right track. One thing I'm assuming here is that you want to format the cell to the right of the cell with the value - is that correct? If so, you actually don't need to use an if formula (though your logic is correct). In that dialog box, make the formula:

=A1=10

And then when you click OK, change the Applies to range by clicking on the little chart icon next to it and clicking cell B1. Then do apply, etc., close out the box and try typing 10 in A1. When you need to expand the range, you can just change that Applies to range to encompass everything you want affected. In the example below, cells B1:B26 will all change if 10 is entered in the cell directly to the left (column A).

enter image description here