Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
COL COL is offline
external usenet poster
 
Posts: 3
Default Replacing an ERROR message with "NA"

I have created a table and some of the cells display the message "#DIV/0"
which I expected would happen, yet I want to automate the document so that
all error messages are replaced by the text message "NA". It's a large
document and it would take a very long time to change each cell manually so I
was hoping someone could help me. I also update it often, therefore I need to
keep the formula in the cell and if I type NA in the cell the formula will be
erased...

Does anybody know how to fix this?

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,316
Default Replacing an ERROR message with "NA"

You can use this generic IF statement to work around errors:

IF(ISERROR(Formula),"N/A",Formula)

If you're dividing A1 by B1 the IF statement would read:

IF(ISERROR(A1/B1),"N/A",A1/B1)
--
Kevin Backmann


"COL" wrote:

I have created a table and some of the cells display the message "#DIV/0"
which I expected would happen, yet I want to automate the document so that
all error messages are replaced by the text message "NA". It's a large
document and it would take a very long time to change each cell manually so I
was hoping someone could help me. I also update it often, therefore I need to
keep the formula in the cell and if I type NA in the cell the formula will be
erased...

Does anybody know how to fix this?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Replacing an ERROR message with "NA"


If I use a formula that has expected errors in it I use ISERROR.

Example

I am dividing cell d2/c2 and an error is expected I will use the formula

+if(iserror(d2/c2),Response I want,d2/c2)


"COL" wrote in message
...
I have created a table and some of the cells display the message "#DIV/0"
which I expected would happen, yet I want to automate the document so that
all error messages are replaced by the text message "NA". It's a large
document and it would take a very long time to change each cell manually
so I
was hoping someone could help me. I also update it often, therefore I need
to
keep the formula in the cell and if I type NA in the cell the formula will
be
erased...

Does anybody know how to fix this?



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 180
Default Replacing an ERROR message with "NA"

You could augment your existing formula with a test for a 0 denominator. For
instance, if you've got =(a1/b1), you could make that =if(b1=0,"NA",a1/b1).
Then you've got a formula that will update automatically along with a means
to replace the #DIV/0 error.

"COL" wrote:

I have created a table and some of the cells display the message "#DIV/0"
which I expected would happen, yet I want to automate the document so that
all error messages are replaced by the text message "NA". It's a large
document and it would take a very long time to change each cell manually so I
was hoping someone could help me. I also update it often, therefore I need to
keep the formula in the cell and if I type NA in the cell the formula will be
erased...

Does anybody know how to fix this?

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Replacing an ERROR message with "NA"

To change all at once use this macro after selecting your used range on the
sheet.

It will ignore cells without formulas.

Sub ErrorTrapAdd()
Dim myStr As String
Dim cel As Range
For Each cel In Selection
If cel.HasFormula = True Then
If Not cel.Formula Like "=IF(ISERROR*" Then
myStr = Right(cel.Formula, Len(cel.Formula) - 1)
cel.Value = "=IF(ISERROR(" & myStr & "),""NA""," & myStr & ")"
End If
End If
Next
End Sub


Gord Dibben MS Excel MVP


On Thu, 13 Jul 2006 12:44:01 -0700, COL wrote:

I have created a table and some of the cells display the message "#DIV/0"
which I expected would happen, yet I want to automate the document so that
all error messages are replaced by the text message "NA". It's a large
document and it would take a very long time to change each cell manually so I
was hoping someone could help me. I also update it often, therefore I need to
keep the formula in the cell and if I type NA in the cell the formula will be
erased...

Does anybody know how to fix this?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
question about excessive code in replacing #N/A when using VLOOKUP njuneardave Excel Discussion (Misc queries) 4 June 21st 06 03:14 AM
How do I replace an asterisk without replacing everything? Trw Excel Discussion (Misc queries) 4 June 9th 06 10:54 PM
replacing #N/A values with zero values Ted Excel Worksheet Functions 11 February 16th 06 10:58 PM
Stopping autoformat when replacing cells. Jaelou New Users to Excel 3 January 26th 06 03:02 PM
XL 2003: Replacing X-Axis Labels with Custom Ones... Birmangirl Charts and Charting in Excel 1 December 7th 05 04:09 AM


All times are GMT +1. The time now is 03:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"