Answer the question
In order to leave comments, you need to log in
How to generate random numbers under certain conditions?
The task is as follows: in five cells A1-A5, generate random numbers from 0 to 200 (integer) so that the sum of these numbers is not greater than the value in cell B1 (for example, 700).
upd:
=RANDOMBETWEEN(0;B1/5) = doesn't solve the problem because it will generate from 0 to 140, not up to 200. Just as I understand, this function does not allow duplicate random numbers. And for me, this random chance option that I indicated below is quite satisfactory / I need support:
200
0
100
200
200
Answer the question
In order to leave comments, you need to log in
The upper bound for numbers 4 and 5 (Sl4, Sl5) should be checked and not just assumed to be 200.
=RANDBETWEEN(0;200)
=RANDBETWEEN(0;200)
=RANDBETWEEN(0;200)
=RANDBETWEEN(0;IF(B1-SUM(B3:B5)<200;B1-SUM(B3:B5);200))
=RANDBETWEEN(0;IF(B1-SUM(B3:B6)<200;B1-SUM(B3:B6);200))
=SUM(B3:B7)
Generate in the range 0..B1/5 , this ensures that the condition is met.
=ЦЕЛОЕ(СЛУЧМЕЖДУ(0;$B$1/5))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question