excel divide by zero error

T

Titanium

I'm trying to write a formula to calculate the percentage of two cells. The
simplified formula reads:
=B12/(B12 + H12)

The problem is when H12 and B12 both = zero. Zero divided by zero = divide
by zero error.

The desired result, display 0%

I looked at the online help, and it gives me a sample formula, but for the
life of me, i just can't seem to get it to work out with 'my desired
result'...

help... please... :)
 
T

Titanium

hate to bother you yet again, but I'm trying to make sure that I understand
the statement you wrote... can you please explain the syntax, I'm just trying
to make better sense of it than i'm doing on my own... :)
 
G

Gary''s Student

No problem:

What the IF does is to say that if B12 is zero, don't both to do the
division, just return zero. This approach works if B12 and H12 are both zero.

Another case that you didn't mention is something like B12=-1 and H12=+1 In
this case you would want something like:

=IF((B12+H12)=0,0,B12/(B12+H12))

I like this form better because it covers both cases.
 
T

Titanium

That's what I thought, but... i didn't want to start making assumptions on
syntax. I find it better to be sure about something, because when you want to
put it to use, poor understanding of the syntax only leads to errors,
logically or otherwise... Although it's impossible to obtain a -1 in my
particular case, I like the second formula better as well. :) btw, tell Gary
he's a great teacher ;) Thanks for all your help! :)
 

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