Dividing by Zero

T

TomRW

If I have 8 in A1 and 2 in A2 I get 25%.

But if I have 8 in A1 and 0 in A2 I get #DIV/0!. When I want to get 0
or 0%.

Simple remedy?
 
D

David Biddulph

I'm intrigued as to what formula you are using that gives those results? If
you've got 8 in A1 and 2 in A2, then the most obvious formula to give 25%
would be =A2/A1, but if that is the formula you wouldn't get a #DIV/0! when
A2 is 0. If you are trying to protect against A1 (rather than A2) being
zero, then you could use =IF(A1=0,0,A2/A1), but be careful if you use that
formula, as you wouldn't see the difference in result between A1 being zero
and A2 being zero. As you reduce the value of A1, the result of the
division increases, but you have asked for it to reduce again when you get
to A1 being zero; the result of the division should be infinite, not zero,
so make sure that you don't confuse yourself.
 
Top