Generate random numbers within a defined set of probabilities

stevech

New Member
Joined
Jul 20, 2009
Messages
3
Hello,
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>
I am hoping that someone can help with a problem. I need to generate random numbers in Excel 2003 within a defined set of probabilities:
30% of numbers between 1,501 and 2000
40% of numbers between 1,000 and 1,500
30% of numbers between 100 and 1,000
<o:p> </o:p>
My attempts so far have been:
In cell A1: Rand()
In Cell A2: =IF(+A1>.7, =randbetween(100,1000), IF(+A1>.3, =randbetween(1001,1500), IF(+A1>0, =randbetween(1501,2000))))
<o:p> </o:p>
Excel 2003 generates syntax errors for the formula in A2. I have also tried:
In cell A1: Rand()
In Cell A2: =IF(+A1>.7, =randbetween(100,1000, IF(+A1>.3, =randbetween(1001,1500, IF(+A1>0, =randbetween(1501,2000)))
<o:p> </o:p>
That also generates syntax errors.
<o:p> </o:p>
It looks like it isn’t possible to embed Randbetween() statements into an IF statement within Excel 2003. By now you have probably guessed that I am new to this. Is anyone able to suggest a solution?
<o:p> </o:p>
Regards,
stevech
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hello and welcome to the board,

why not simply put randbetween in 3 phases, like
Excel Workbook
B
11939
21711
31690
41439
51290
61385
71101
8424
9495
10579
Sheet4
Excel 2003
Cell Formulas
RangeFormula
B1=RANDBETWEEN(1501,2000)
B2=RANDBETWEEN(1501,2000)
B3=RANDBETWEEN(1501,2000)
B4=RANDBETWEEN(1000,1500)
B5=RANDBETWEEN(1000,1500)
B6=RANDBETWEEN(1000,1500)
B7=RANDBETWEEN(1000,1500)
B8=RANDBETWEEN(100,1000)
B9=RANDBETWEEN(100,1000)
B10=RANDBETWEEN(100,1000)


then use anohter column with randbetween 1 & 10, and paste special values and sort by helper column
 
Upvote 0
Steve

I can't tell if there's anything else wrong with your formulas (I'm on 2003 & don't have randbetween implemented), but I think the first one might work if you remove the '=' from before the randbetween function calls.
 
Upvote 0
Hi Weaver,

You are right, my original formula worked after I removed the "=" from the Randbetween calls on A2. Thanks very much - 2 solutions for the price of one.....

Cheers.......Steve
 
Upvote 0
Hi Weaver,

You are right, my original formula worked after I removed the "=" from the Randbetween calls on A2. Thanks very much - 2 solutions for the price of one.....

Cheers.......Steve


there is no price for anything in this board,:)

at times, you might get more than that:)
 
Upvote 0

Forum statistics

Threads
1,222,646
Messages
6,167,311
Members
452,109
Latest member
nathanle89

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