#div/0!


S

srctr

I have a formula

=IF(H2=0, "0.00%", H2/F2)

This works great if H2 is zero. But if F2 is zero I get the #DIV/0! error.
I tried the following

=IF(ISERROR(H2/F2),"0.00%",H2/F2)

However it gives me 0.00% if F2 is zero but gives me 0 if H2 is zero.

I want the answer 0.00% if either H2 or F2 are zero.

I do I do that? Thanks
 
Ad

Advertisements

J

JoeU2004

srctr said:
I have a formula
=IF(H2=0, "0.00%", H2/F2)
[....]
I want the answer 0.00% if either H2 or F2 are zero.

And I suspect you want the __number__ 0.00% in both cases, and x.xx% in all
other cases.

To that end, try:

=if(F2=0, 0, H2/F2)

formatted as Percentage with 2 decimal places (click on Format > Cells >
Number).


----- original messages -----
 
S

Shane Devenshire

Hi,

Try

=IF(F2=0,0,H2/F2)

and format the cell to percent 2 decimals. Or if F2 will be blank but no a
0, you could use

=IF(F2,H2/F2,0)


Note the problem with using "0.00%" is that the entry is text and this may
result in problems elsewhere.
 
Ad

Advertisements

S

srctr

Thanks everyone for your help. I liked the formulas that actual left it as a
number instead of text.
 

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