Hi SG,
Both statements are correct.
Both point out the circumstances under which the shorter formula will succeed and both point out the circumstances under which the shorter formula will fail.
The initial statement, in the question's title, is "Calculate value only if two cell values greater than zero"
The first restatement, in the initial post repeats that: "I would like Numbers to look at two cells, and carry out a calculation only if both those cells are >0"
The second restatement, in the same post repeats: "…if J1>0 and R1>0, then return the result of S1/J1."
…and continues with the parenthetical statement "(if either J1 or R1 are not > 0, then return a blank cell)"
Wayne's 'longer' formula is a direct translation of the specification into an IF statement.
IF(AND(J1>0, R1>0), S1/J1, "")
AND returns true only if J1 is greater than zero AND R1 is also greater than zero.
AND returns false under three conditons: J1 is zero or less,
R1 is zero or less,
both J1 and R1 are zero or less.
The third condition is redundant. If both are zero or less, then the first condition (and the second) are already met.
The shorter formula does not test each value. Instead, it calculates the product of the two values, then tests the result in the IF statement:
IF(J1*R1>0,S1/J1,"")
The multiplication result will be: zero if either (or both) J1 and R1 is zero. (result: "") √
less than zero if J1 is greater than zero and R1 is less than zero (result: "") √
less than zero if R1 is greater than zero and J1 is less than zero (result: "") √
greater than zero if J1 is greater than zero and R1 is greater than zero (result: S1/J1) √
but greater than zero if J1 is less than zero and R1 is less than zero (result: S1/J1) x
Whether the shorter formula is suitable for the job depends on whether negative values are possible for both J1 and R1. If the minimum value for either is zero, the shorter formula will do the job. If J1 and R1 can have negative values, the shorter formula will fail on occasions where both J1 and R1 are negative.
A second issue may also arise, due to the use of the multiplication operator in the shorter formula, and depending on how the values in J1 and R1 are determined.
If those values are entered directly, and an apparently 'blank' cell is really empty, the calculation in the shorter formula should work correctly (except as noted above). If either is the result of a formula that uses a null string ( "" ) to create the appearance of an empty cell, the multiplication operator will likely crash when presented with this text value, producing an error triangle and this message: ' The operator “*” expects a number but found “.” '
Regards,
Barry