View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Help with formula (IF)

=IF(AND(B11=0,A11=0),"0%",IF(B11=0,"-100%",IF(A11=0,"100%",(B11/A11)/B11)))

but you would be better not outputting text,

=IF(AND(B11=0,A11=0),0,IF(B11=0,-1,IF(A11=0,1,(B11/A11)/B11)))

and format as a percentage

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Gmaz" wrote in message
...
I have simple task to calculate % between two numbers:

A B %
1 2 +50%
2 1 -50%
1 1 0%

No problem until I dont get 0 as value in columns. Now I have found
solution to solve if A is 0, or if B is 0, but what to do if both values
are 0, because I got error sign and my table must be "clean".

=IF(B11=0;"-100%";IF(A11=0;"100%";(B11/A11)/B11))

This is what I have on right now but for both values 0 I get -100% instead
of 0.

Thank you in advance.