Hello,
referring to the solution which has been presented to you:
=RANDBETWEEN(1;7)+(CURRENT()>=A2)
(in question Error 502 produced inconsistently with Randbetween/Choose nested function)
If you enter that formula into a cell, the following happens:
- Formula is read / evaluated from left to right
- It evaluates
=RANDBETWEEN(1;7)
(and the result is stored in some internal variable/register)
- Now a plus
+
operation appears, indicating that something should be added to the current value (and here is the buzzword and why the function is named the way it is named)
- Function
CURRENT()
provides access to the stored value of =RANDBETWEEN(1;7)
in step above and in fact (CURRENT()>=A2)
evaluates
either TRUE
(1
), if the condition is fulfilled (i.e. condition =RANDBETWEEN(1;7)>=A2
is fulfilled) and essentially calculates =RANDBETWEEN(1;7) + 1
,
or FALSE
(0
), if the condition is not fulfilled (i.e. condition =RANDBETWEEN(1;7)>=A2
is not fulfilled) and essentially calculates =RANDBETWEEN(1;7) + 0
.
Very briefly: Function CURRENT()
returns the current value of a cell evaluation as it is just before CURRENT()
is being called (very simple case: 1+CURRENT()
yields 2
).
Ref.: LibreOffice Help - CURRENT (which indeed is a bit a twisted explanation, but the examples are quite clear)
Hope that explains, what’s going on.