Walter Hildebrandt wrote:
Sorry for not being completely clear in what I have ask.
When in A1 there is 1.61 and in B1 there is 1.36. In C1 the original
formula =A1-B1)/B1 gives the answer of 18%. The formula =IF(A1-B1 <
0;0;A1-B1) gives the wrong answer of 25% in C1
When in A1 there is 23 and in B1 there is 33 In C1 the original formula
=A1-B1)/B1 gives the answer of -30%. The formula =IF(A1-B1 < 0;0;A1-B1)
gives the wrong answer of 0% in C1
If there is a negative number in either A1 or B1, then C1 should be empty
(C1 should not have a 0% in it)
On Sat, May 30, 2009 at 9:08 PM, Keith N. McKenna <[email protected]
wrote:
Walter Hildebrandt wrote:
In Calc I am using the following formula in cell C1
=A1-B1)/B1
Is there some way to get an empty C1 cell when there is a negative number
in
either A1 or B1?
Walter;
Put this if statement into cell C1. =IF(A1-B1 < 0;0;A1-B1) which says If
the difference of A1-B1 is less than 0; C1 = zero; else C1 = A1-B1
Hope this helps
Keith
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Walter;
Sorry about that I misread your original message. Let me see if I
have this straight. In the example of A= 23 and be = 33 you want the
result in C to be the -.30 but if either A or B is a negative number you
want the result in C to be blank. Is that correct? If it is the
following formula will do that, =IF(A1<0;"";IF(B1<0;"";(A1-B1)/B1)) I am
sure there is an easier way, but I have tested it with your numbers and
it does what you want I believe. If not please post again and I will
give it another go. The formula first tests if A1 is a negative number,
if it is it sets C1 to blank, If it isn't it tests if B1 is negative and
it it is sets C1 to blank. Finally if neither are negative, it sets C1 =
(A1-B1)/B1
Regards
Keith
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]