18.11.2014 Views

Microsoft Office

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Visualizing Data Using Conditional Formatting 21<br />

Understanding relative and absolute references<br />

If the formula that you enter into the Conditional Formatting dialog box contains a cell reference, that reference<br />

is considered a relative reference, based on the upper-left cell in the selected range.<br />

For example, suppose that you want to set up a conditional formatting condition that applies shading to<br />

cells in range A1:B10 only if the cell contains text. None of Excel’s conditional formatting options can do<br />

this task, so you need to create a formula that will return TRUE if the cell contains text and FALSE otherwise.<br />

Follow these steps:<br />

1. Select the range A1:B10 and ensure that cell A1 is the active cell.<br />

2. Choose Home ➪ Styles ➪ Conditional Formatting ➪ New Rule to display the New<br />

Formatting Rule dialog box.<br />

3. Click the rule type labeled Use A Formula To Determine Which Cells To Format.<br />

4. Enter the following formula in the Formula box:<br />

=ISTEXT(A1)<br />

5. Click the Format button to display the Format Cells dialog box.<br />

6. In the Format Cells dialog box, click the Fill tab and specify the cell shading that will be<br />

applied if the formula returns TRUE.<br />

7. Click OK to return to the New Formatting Rule dialog box (refer to Figure 21.16).<br />

8. In the New Formatting Rule dialog box, click the Preview button to make sure that the formula<br />

is working correctly and to see a preview of your selected formatting.<br />

9. If the preview looks correct, click OK to close the New Formatting Rule dialog box.<br />

Notice that the formula entered in Step 4 contains a relative reference to the upper-left cell in the selected<br />

range.<br />

Generally, when entering a conditional formatting formula for a range of cells, you’ll use a reference to the<br />

active cell, which is normally the upper-left cell in the selected range. One exception is when you need to<br />

refer to a specific cell. For example, suppose that you select range A1:B10, and you want to apply formatting<br />

to all cells in the range that exceed the value in cell C1. Enter this conditional formatting formula:<br />

=A1>$C$1<br />

In this case, the reference to cell C1 is an absolute reference; it will not be adjusted for the cells in the<br />

selected range. In other words, the conditional formatting formula for cell A2 looks like this:<br />

=A2>$C$1<br />

The relative cell reference is adjusted, but the absolute cell reference is not.<br />

435

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!