Generating condition-based random numbers that sum to a specific value

Stefan22

New Member
Joined
May 9, 2010
Messages
34
Hi,
I'm know a formula can be written that generates a set of random numbers that adds up to a specific sum,
or a formula that generates a set of random numbers in a specific interval. However, it is not clear to me how
to integrate these two formulas to solve my problem.

Ideally, my worksheet should look something like this:

ABCDEF
12015-02-25random no.1MAX (random no.1)random no.1MAX (random no.1)MAX (B1+D1)
22015-02-26random no.2MAX (random no.2)random no.2MAX (random no.2)MAX (B2+D2)
32015-02-27random no.3MAX (random no.3)random no.3MAX (random no.3)MAX (B3+D3)
42015-02-28random no.4
MAX (random no.4)random no.4MAX (random no.4)MAX (B4+D4)
5SUMSUM

<tbody>
</tbody>

The values which should be returned are put in bold and italic (B1:B4 and D1:D4).
These values should be random while satisfying the following criteria:
1) be less than a user defined maximum located in a cell adjacent to it (maximum for B1 is in C1 and so on...),
2) add up to a user defined maximum located in F1:F4,
3) add up to a user defined maximum located in B5 and D5.

Also, the sum values in B5 and D5 are dynamic (decreasing) based on a date value.
For example: let's say on 2015-02-25 we wanted to generate 4 random numbers (B1:B4) that add up to 10 (B5),
Initially our formula returned 4,3,3,0. Since today's date is 2015-02-26, the value in B1 (which is 4) no longer counts and our new sum
value is 10-4=6, so the new set of numbers could be 1, 1, 4 or 2, 2, 2 etc. (the last remained values in columns B and D will always equal their respective sums). Obviously, this example ignored horizontal conditions
that must be met as well.

If something is not clear due to my limited english (or any other reason), please ask for clarification.

Any help will be greatly appreciated.

Stefan
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top