# Macro Problem with 2 intertwining rules

#### JustARandomGuy

##### New Member
I need a module to randomly fill in a table (F3:I32) with the numbers 41-80 when I press a button. Each number must appear 3 times each and can only appear no more than once in each row. Can someone please help me and guide me through how to do it? Thanks in advance

### Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
That's a pretty random question.

Why?

Well I'm making a simulation of playing cards. There are 30 piles of 4 cards made up of 3x40 different cards. Each pile cannot having duplicates and there are 3 copies of each card. Pressing the button randomises the results.

There are 120 different cards??

Please explain further. There are lots of ways to shuffle a deck of cards.

There are 40 different cards, with 3 copies of each for a total of 120 cards. I have to slot each card into the 30 row, 4 column table. There cannot be 2 or more copies of one card in the same row.

There cannot be 2 or more copies of one card in the same row.
Pardon the extraneous question, but why not? That's not random, it's restrictive. What are you trying to model?

And having said that, I'm off to bed, so perhaps someone else can sort it out before I look back in tomorrow.

03.24.2013-11.38.03 - sdruley's library

This is a "pseudo" random table. If you like what you see, let me know and I will try to get to you the modules required to generate it.
The table is generated using a master seed followed by two random manipulations of the table to meet your specifications. So this is a combination of pure random numbers and randomly applied methods. A pure random table, as you requested, is not possible as you have defined it. I believe that shg's comments also begin to question the feasibility of a pure random table in this sense. If shg starts to question something then we all need to be careful about what we are doing.

It looks perfect and I would be happy if you could give me what I need to make that table but I don't understand what you mean by 'pseudo' random. What makes it not completely random? Also, will the table work with VLOOKUP? I'm just asking because I've come across some modules in the past that don't work with VLOOKUP.

Last edited:
Only natural processes (e.g., radioactivity, Brownian motion) are random. Computers use totally deterministic algorithms (e.g., linear congruential generators) to generate long sequences that have (close to) the statistical properties of random numbers.

See Description of the RAND function in Excel

Ok, I understand. In any case the "pseudo" random table is fine.

Replies
0
Views
73
Replies
0
Views
112
Replies
0
Views
148
Replies
2
Views
508
Replies
0
Views
138

1,203,051
Messages
6,053,221
Members
444,648
Latest member
sinkuan85

### 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.

### Which adblocker are you using?

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

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