Microsoft KB Archive/154874

= XL97: How to Create a Conditional Format to Hide Errors =

Article ID: 154874

Article Last Modified on 10/21/2000

-

APPLIES TO


 * Microsoft Excel 97 Standard Edition

-



This article was previously published under Q154874



SUMMARY
In Microsoft Excel, you can create conditional formatting on a cell, or a range of cells, so that error values are not displayed in the cell(s).



MORE INFORMATION
In versions of Microsoft Excel earlier than Excel 97, you could not create a custom number format to hide error values returned to the cell by the cell formula. For example, if you enter the following in your worksheet:

A1: =B1/C1 B1: 5 C1: 0

you would get #DIV/0! returned to cell A1. You can change the formula in cell A1 to hide the error value to the following: =IF(ISERROR(B1/C1),"",B1/C1) With the example values given above, this formula returns the empty string ("").

Note, there are other techniques for hiding error values that you can use in versions of Microsoft Excel earlier than Microsoft Excel 97.

For additional information, please see the following article in the Microsoft Knowledge Base:

87299 XL: How to Suppress Error Values on a Worksheet

There is a new feature in Microsoft Excel 97 called Conditional Formatting that allows you to use the simpler of the two formulas in cell A1, and still prevent the error value from showing in cell A1.

The following example steps you through the use of Conditional Formatting to hide error values returned by formulas in cells:

  Enter the following in a worksheet:      A1: =B1/C1          B1: 5   C1: 0 A2: =nofunction*B2 B2: 6   C2: 0 Note: cell A1 returns the #DIV/0! error value, and cell A2 returns the #NAME? error value because nofunction (used in cell A2) is not a valid function.  Select column A. On the Format menu, click Conditional Formatting. In the Conditional Formatting dialog box, click the Condition 1 drop-down and click "Formula Is". In the edit box to the right of the Condition 1 drop-down, enter the following formula:

=ISERROR(A1)

 Click the Format button. In the Format Cells dialog box, click the Color: drop-down, and click the White square.</li> Click OK in the Format Cells dialog box, and then click OK in the Conditional Formatting dialog box.

NOTE: Because you selected column A in step 2, all the cells in column A were formatted with this Conditional Format. So, any other cells in column A that return error values will not display the error value.</li></ol>

<div class="references_section">