How do I get rid of the #/DIV/0! message

G

Guest

If I have a formula say (A2+A10)*A12/A15 if A15 is blank it returns
#/DIV/0!, how do i get it to return 0
 
N

Niek Otten

=IF(A15=0,0,(A2+A10)*A12/A15)

--
Kind regards,

Niek Otten

Microsoft MVP - Excel
 
H

Harlan Grove

Hayeso wrote...
=IF(ISERR((A2+A10)*A12/A15),"",(A2+A10)*A12/A15)
....

Errors are not always a bad thing to see. #REF!, #NULL!, #NUM! and
#NAME? are always beneficial diagnostically. #DIV/0! is always easy to
avoid in direct calculations (check if the denominator term is zero).
Only #VALUE! and #N/A require trapping on an all too frequent basis.

Next, ISERR as opposed to ISERROR won't trap #N/A. Maybe you intended
that, but why allow #N/A but not #REF!, #NULL!, #NUM! and #NAME?
results?

In general you should only trap expected errors or expected values that
would give rise to errors, such as blank denominator terms. In this
case, the formula should only trap cell A15 blank, not A15=0. So

=IF(ISBLANK(A15),0,(A2+A10)*A12/A15)

and if this were part of a larger formula, you could use only a single
level of function calls with

(A2+A10)*A12*(1-ISBLANK(A15))/(A15+ISBLANK(A15))

More generally, to trap only specific errors, use

=IF(COUNT(1/(ERROR.TYPE(x)={3,7})),"error result","nonerror result")

where 3 == #VALUE! and 7 == #N/A.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top