Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Helpwanted
 
Posts: n/a
Default # DIV/0! error in Excel

I have a function that divides two numbers, sometimes those numbers are 0 so
the result is # DIV/0!. My second function is based on the result of the
first function. Since there isnt always data available for the first function
I get the # DIV/0! error and my final calculation wont calculate. I need the
final calculation to disregard any 0 cells or # DIV/0! errors and still
calculate the data that is available.
  #2   Report Post  
 
Posts: n/a
Default

Hi
You need to wrap your division with an IF() so it will evalluate the result
before it puts anything in the cell. Try something like:
=IF(A20,A3/A2,0)

--
Andy.


"Helpwanted" wrote in message
...
I have a function that divides two numbers, sometimes those numbers are 0
so
the result is # DIV/0!. My second function is based on the result of the
first function. Since there isnt always data available for the first
function
I get the # DIV/0! error and my final calculation wont calculate. I need
the
final calculation to disregard any 0 cells or # DIV/0! errors and still
calculate the data that is available.



  #3   Report Post  
Bill Martin -- (Remove NOSPAM from address)
 
Posts: n/a
Default

Andy B wrote:
Hi
You need to wrap your division with an IF() so it will evalluate the result
before it puts anything in the cell. Try something like:
=IF(A20,A3/A2,0)


Or perhaps a more appropriate approximation fudge would be:

=IF(A20,A3/A2,1E300)

Bill
  #4   Report Post  
Bill Martin -- (Remove NOSPAM from address)
 
Posts: n/a
Default

Andy B wrote:
Hi
You need to wrap your division with an IF() so it will evalluate the result
before it puts anything in the cell. Try something like:
=IF(A20,A3/A2,0)



Or perhaps a better approximation fudge would be:

=IF(A20,A3/A2,If(A30,1e300,-1e300))

Bill
  #5   Report Post  
 
Posts: n/a
Default

Hi Bill
Why do you say that putting 1e300 would be a 'better approximation fudge'? I
don't understand what that contributes towards the result!
Cheers.
--
Andy.
PS I can't believe I spelt evaluation with a double 'l'!!

"Bill Martin -- (Remove NOSPAM from address)"
wrote in message ...
Andy B wrote:
Hi
You need to wrap your division with an IF() so it will evalluate the
result before it puts anything in the cell. Try something like:
=IF(A20,A3/A2,0)



Or perhaps a better approximation fudge would be:

=IF(A20,A3/A2,If(A30,1e300,-1e300))

Bill





  #6   Report Post  
Lewis Clark
 
Posts: n/a
Default

Because 1e300 is a very large number. When you divide by zero, you get an
infinitely large number.

Which one you use should depend on how you use this value in the next
calculation.


<Andy B wrote in message ...
Hi Bill
Why do you say that putting 1e300 would be a 'better approximation fudge'?
I don't understand what that contributes towards the result!



  #7   Report Post  
Bill Martin -- (Remove NOSPAM from address)
 
Posts: n/a
Default

Andy B wrote:
Hi Bill
Why do you say that putting 1e300 would be a 'better approximation fudge'? I
don't understand what that contributes towards the result!
Cheers.



It's a matter of how to handle errors. For example, say you're trying
to evaluate your return on investment. You invest $5 and get $10 back.
Divide 10/5 = 2x return as desired.

Now what would you get if for some reason the investment was $0? Your
original example would say 0 return which is very plainly wrong and
misleading. My version would return a huge number (1E200) which is also
too small, but less so.

This would allow downstream computations to continue, but would show up
in the end as a huge stand out number which would flag that something
peculiar was going on that should be investigated. Inserting "0" would
hide the error rather than flagging it.

The only thing worse than a spreadsheet which returns incorrect results
might be one that also hides the fact that it's lied to you.

IMHO....

Bill
  #8   Report Post  
LabElf
 
Posts: n/a
Default

I have to quibble. Strictly speaking, division by zero is meaningless - you
can't divide anything into zero parts. You could, however, speak of the
limit of (1/n) as n - 0 as tending toward inifinity.
--
Assigning guilt doesn't solve the problem


"Lewis Clark" wrote:

Because 1e300 is a very large number. When you divide by zero, you get an
infinitely large number.

Which one you use should depend on how you use this value in the next
calculation.


<Andy B wrote in message ...
Hi Bill
Why do you say that putting 1e300 would be a 'better approximation fudge'?
I don't understand what that contributes towards the result!




  #9   Report Post  
Jay
 
Posts: n/a
Default

I have a function that divides two numbers, sometimes those numbers
are 0 so the result is # DIV/0!. My second function is based on the
result of the first function. Since there isnt always data available
for the first function I get the # DIV/0! error and my final
calculation wont calculate. I need the final calculation to disregard
any 0 cells or # DIV/0! errors and still calculate the data that is
available.


Here's one way.

Suppose the first function is in A1.

Then for the second function, you could put something like:
=IF(ISERROR(A1),"N/A", <your second function here )

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
Getting Excel Data from One Sheet to Another.... Robin Excel Discussion (Misc queries) 2 April 21st 05 01:15 PM
Stop Excel Rounding Dates leinad512 Excel Discussion (Misc queries) 1 April 20th 05 04:19 PM
Hints And Tips For New Posters In The Excel Newsgroups Gary Brown Excel Worksheet Functions 0 April 15th 05 05:47 PM
Excel error - Startup (and Acrobat PDFMaker) gxdata Setting up and Configuration of Excel 0 February 4th 05 03:44 AM
Excel 2002 and 2000 co-install. Control Which Starts ? cnuk Excel Discussion (Misc queries) 2 January 17th 05 08:07 PM


All times are GMT +1. The time now is 08:09 AM.

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"