At 19:34 30/05/2009 -0600, Walter Hildebrandt wrote:
In Calc I am using the following formula in cell C1
=A1-B1)/B1

Er, I trust you are not - since this is not a valid formula.  Perhaps you mean:
     =(A1-B1)/B1

Is there some way to get an empty C1 cell when there is a negative number in either A1 or B1?

Yes.  Try:
     =IF(AND(A1>=0;B1>0);(A1-B1)/B1;"")
The two conditions for A1 and B1 to be non-negative are combined using the AND() function. If these are both satisfied, your original formula is used; otherwise, the result is a null string.

An alternative is:
     =IF((A1>=0)*(B1>0);(A1-B1)/B1;"")
Here the two conditions are treated as numbers (FALSE=0; TRUE=1) and multiplied. The result is then treated as a logical value: only if both conditions are satisfied is the result TRUE - with the same result as above.

Note that in both formulae above I have required B1 to be greater than zero - not just greater than or equal to - since you wouldn't want to divide by zero!

I trust this helps.

Brian Barker


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to