![]() |
#1
|
|||
|
|||
![]()
Hi,
I need some help developing a formula that I believe should probably include RandBetween. I need 50 random numbers total to be placed in column J starting at row 6. I have a target number in cell J3 that all 50 random numbers generated must sum to. Each of the 50 numbers cannot be a larger number than that of the number found in the same row in column I (the numbers in column I change with each row). Example is below: I J 3 6000 4 5 6 1505 rand 7 5625 rand 8 2568 rand 9 3256 rand in this example all rand numbers in rows 6-9 will sum to 6000 (found in J3) but will not be larger then their corresponding numbers in column I. So, one combination could be 1123, 856, 2568, 1453. Can anyone help with a formula NOT VBA method? Many thanks, Ann |
#2
|
||||
|
||||
![]()
That is INTERESTING, acbh! I don't even care why you want such an outlandish thing, it's just fascinating to think about it.
Ok, first let me reproduce your sample in a fixed-spacing font so I can see it clearly: Code:
I J ---- ---- 3 6000 4 5 6 1505 rand 7 5625 rand 8 2568 rand 9 3256 rand The other three numbers must be random, but they must not be allowed to be so small that their sum is less than J$3-I$9. Let's see, a random number for any row is too small if it, plus all the random numbers below it, plus all the maximum allowed numbers for the rows after it, will still be less than J3. So the bottom value for J7 (for example) is "=J$3-SUM(I8:I$9)-SUM(J$6:J6)". No, wait, it has to start below J6. So what happens if we use this for J6:J8? Code:
=RANDBETWEEN(J$3-SUM(I8:I$9)-SUM(J$5:J6),$I7) It isn't necessarily the best answer. It could be you won't care for the distribution, too many high numbers at the top and too many low ones at the end, or something. But I'll start by claiming to have found what you want. If you want to improve on it, for example by forbidding negative numbers, speak up and let's see where this goes from here. |
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
OTPM | Excel | 2 | 05-22-2013 06:28 AM |
Formula Help | OTPM | Excel | 5 | 02-21-2013 08:03 AM |
![]() |
AndrewSE | Excel | 3 | 04-05-2011 08:50 PM |
![]() |
sixhobbits | Excel | 1 | 10-02-2009 08:02 AM |
Help for formula | dehann | Excel | 5 | 05-01-2009 10:44 AM |