Creating a Random Text Generator

Cquake

Board Regular
Joined
Dec 12, 2017
Messages
60
Office Version
  1. 2016
Platform
  1. Windows
I am trying to create a random text generator but I need the following chances assigned to the following letters.

C = 20%, I = 70% and P = 10%. These variables will change with each new block but if I can get help on the first part I will know what to do. I do know that I could use the following formula below that would work but was wondering if there is another way to do that with just typing in the 3 letters and assigning them a chance value in that formula.

=CHOOSE(RANDBETWEEN(1,10),"Com","Com","Inc","Inc","inc","inc","inc","inc","inc","P")

Thanks
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Hi Cquake,

Following the solution presented here:
HTML:
https://www.mrexcel.com/forum/excel-questions/513950-weighted-randbetween.html

You can paste the following into your Excel sheet:
[TABLE="width: 192"]
<colgroup><col width="64" span="3" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]Num[/TD]
[TD="width: 64"]Prob[/TD]
[TD="width: 64"]Cumu[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD="align: right"]0.2[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]I[/TD]
[TD="align: right"]0.7[/TD]
[TD="align: right"]0.2[/TD]
[/TR]
[TR]
[TD]P[/TD]
[TD="align: right"]0.1[/TD]
[TD="align: right"]0.9[/TD]
[/TR]
</tbody>[/TABLE]

...where cells C3 and below have the following formula:
=SUM(C2,B2)

Afterwards, you can use:
=INDEX($A$2:$A$4, MATCH(RAND(), $C$2:$C$4))

In order to test the accuracy of this formula, simply change the probability (column B) to 1 for "P" and set the rest to zero. The result should always be "P" in such case.

Hope it helps.
 
Upvote 0
Just an added question here. How would that formula change if I chose to have it randomly select a row of data (Think in terms of cards that are being flipped and reading the information from them ). For instance I have a set of data that has 60 rows that range from cell A1 to R1 for each row and I want to have the generator randomly select the entire row of data. The data table will be on its own sheet in the workbook but will need to show up on the main page each time a new random generator is done. I am unable to post a picture right now but will once I get home from work if that would help explain it better.
 
Upvote 0
Hi Cquake, I would appreciate if you could post a picture in order to fully understand what you're looking for. Thanks!
 
Upvote 0
Hi Cquake, I would appreciate if you could post a picture in order to fully understand what you're looking for. Thanks!

Will do but it will be around 9 or 10 my time (CST) this morning.
 
Upvote 0
Hi Cquake, I would appreciate if you could post a picture in order to fully understand what you're looking for. Thanks!

Here is a link to the table I am currently creating in regard to the question I asked. The white cells represent incompletions. https://drive.google.com/file/d/1o-AXyjEQOszUfs6iwueiao61FLLsDF_O/view


Here are the cards in which the data comes off of. If I knew how to go about creating a card flipper inside the program with those cards I would but the only way I know how to go about it at this point is to either create a random number and text generator or set things up like the above the link to read from an entire card.

Hope that makes sense.

Actual RAC card with the blanks, C, P , * Listed on them Game Action Cards that you see the layout above the RAC on main sheet
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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