View Single Post
  #5   Report Post  
 
Posts: n/a
Default

ramana wrote:
I have three columns A,B&C In the column A Iwill generate
random numbers between 40&50, In the Column B I will
generate random numbers between 35&45, The column C is
the sum of Column A&B(i.e. C=A+B) but I the sum should
be between 83&88. I need acondition such that the random
numbers generated in Column A&B Should satisfy the Column C(A+B)


First, your requirements are unclear. Must A, B and C
be integers, or can they be non-integer real numbers?
That is a minor nitpick in the scheme of things. But
you should make your requirements clear.

Second, your specifications are inconsistent. If A must
be 40-50 and C (A+B) must be 83-88, then B must be 33-48.
Alternatively, if B must be 35-45 and C must be 83-88,
then A must be 38-53. Or if A must be 40-50 and B must
be 35-45, then C must be 75-95.

Finally, assuming that A and C (A+B) are the strongest
constraints, I would generate random A and random C
(A+B), then compute B = A-C.

For example, assuming that you want integers:
A1: =RANDBETWEEN(40,50)
C1: =RANDBETWEEN(83,88)
B1: =C1-A1

If RANDBETWEEN() is not available, see the Help text
to learn how to install the Analysis Toolpak add-in.
Alternatively, replace RANDBETWEEN(x,y) with
x+INT((y-x+1)*RAND()).