Avoid repeating value in IF arguments

Hi

In some programming languages you are able to express something like A if A != null else B. This can be expressed in Calc with IF(A; A; B).

Now suppose that A is a long formula. Is there any trick to avoid repeating the long formula in both the 1st and 2nd arguments?

The normal spreadsheet practice is to calculate A in a dedicated cell (column).

1 Like

If you are always checking for zero, it is pretty straightforward. Use the CURRENT() function in a trailing construct like this:

=A+IF(CURRENT()=0;B;0)

EDIT: I see @mikekaganski beat me to it. The Q&As he referenced gives good background detail.