Loading
Excel.Tips.Net ExcelTips (Menu Interface)

Finding and Replacing Error Values

Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Finding and Replacing Error Values.

Lindsay often has huge worksheets with hundreds of rows of calculated values. Inevitably there will be scattered cells with the #N/A error that she would like to all be 0 (or some other value) so she can use the cells in other formulas. Due to the calculations Lindsay is running, she feels an IF formula or other such method to anticipate and remove these values from the calculation is usually impossible, and it's very tedious to remove them by hand. Lindsay wonders if there is any way to do the equivalent of a "find and replace" on those error values.

There are a couple of ways you can approach this issue. One is to use the Go To feature in Excel. Simply follow these steps:

  1. Press F5. Excel displays the Go To dialog box. (See Figure 1.)
  2. Figure 1. The Go To dialog box.

  3. Click Special. Excel displays the Go To Special dialog box. (See Figure 2.)
  4. Figure 2. The Go To Special dialog box.

  5. Make sure the Formulas radio button is selected.
  6. The only check box that should be selected under Formulas is Errors.
  7. Click OK. Excel selects all cells where the formula returned an error value.
  8. Type 0 or whatever value you want.
  9. Press Ctrl+Enter.

Note that this approach results in any error values being replaced, not just those with the #N/A error. If you have to make the replacements quite a bit or you want to only affect #N/A errors, you may want to use a macro to do the replacements:

Sub Replace_NAs()
    Dim C
    For Each C In ActiveSheet.UsedRange
        If Application.WorksheetFunction.IsNA(C) Then
            C.Value = 0
        End If
    Next
End Sub

You should note that all these options result in the formulas in the cells (those that returned the #N/A values) being permanently replaced with a 0 or whatever value you specify. The only way to not replace the formulas is to change those formulas to use an IF statement to check for the error condition before applying the formula.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (6905) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Finding and Replacing Error Values.

Related Tips:

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

 

Leave your own comment:

*Name:
Email:
  Notify me about new comments ONLY FOR THIS TIP
Notify me about new comments ANYWHERE ON THIS SITE
Hide my email address
*Text:
*What is 5+3 (To prevent automated submissions and spam.)
 
 
           Commenting Terms

Comments for this tip:

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
 
 

Our Company

Sharon Parq Associates, Inc.

About Tips.Net

Contact Us

 

Advertise with Us

Our Privacy Policy

Our Sites

Tips.Net

Beauty and Style

Cars

Cleaning

Cooking

DriveTips (Google Drive)

ExcelTips (Excel 97–2003)

ExcelTips (Excel 2007–2016)

Gardening

Health

Home Improvement

Money and Finances

Organizing

Pests and Bugs

Pets and Animals

WindowsTips (Microsoft Windows)

WordTips (Word 97–2003)

WordTips (Word 2007–2016)

Our Products

Helpful E-books

Newsletter Archives

 

Excel Products

Word Products

Our Authors

Author Index

Write for Tips.Net

Copyright © 2016 Sharon Parq Associates, Inc.