J.Ty.
Well-known Member
- Joined
- Feb 4, 2012
- Messages
- 1,118
- Office Version
- 365
- 2013
- 2010
- Platform
- Windows
- Web
Hi Everyone,
I have discovered a strange behavior of the random number generator and cyclic references.
Please have a look at the following simple spreadsheet (tested in Excel 2016 64 bit):
A1 is
B1 is
A quick analysis shows that whenever RANDBETWEEN(-1,0) draws -1 a cyclic reference emerges and Excel should report it. I normal circumstances one should expect the window with the warning to show up roughly every second F9. However, it is much less frequent.
In order to make sure that it is really due to the behavior of the formula, not the reporting system, I have set a conditional formatting rule which makes cell A1 red whenever its value differs from B1. Now, after each recomputation the value of B1 changes; A1 changes if and only if
RANDBETWEEN(-1,0) draws 0, because otherwis eit becomes a part of a cycle and points to itself with the old value.
The effect persists: the cycle warning and/or red color are much less frequent than 50%.
Then I set the itrative calculations on. It switches off the warning window, only the red color indicates the cycle. Still, it is less frequent than 50%.
Can anybody explain this?
J.Ty.
I have discovered a strange behavior of the random number generator and cyclic references.
Please have a look at the following simple spreadsheet (tested in Excel 2016 64 bit):
A1 is
Code:
=OFFSET(B1,0,RANDBETWEEN(-1,0))
B1 is
Code:
=NOW()
A quick analysis shows that whenever RANDBETWEEN(-1,0) draws -1 a cyclic reference emerges and Excel should report it. I normal circumstances one should expect the window with the warning to show up roughly every second F9. However, it is much less frequent.
In order to make sure that it is really due to the behavior of the formula, not the reporting system, I have set a conditional formatting rule which makes cell A1 red whenever its value differs from B1. Now, after each recomputation the value of B1 changes; A1 changes if and only if
RANDBETWEEN(-1,0) draws 0, because otherwis eit becomes a part of a cycle and points to itself with the old value.
The effect persists: the cycle warning and/or red color are much less frequent than 50%.
Then I set the itrative calculations on. It switches off the warning window, only the red color indicates the cycle. Still, it is less frequent than 50%.
Can anybody explain this?
J.Ty.
Last edited: