random number generator

rktucson

New Member
Joined
Jan 27, 2009
Messages
4
I have 4 names, and a grid of 100 boxes. I need those 4 names randomly deposited in the 100 boxes, making sure each name is displayed an equal number of times (25 each) Is there an Excel formula to compute this?

Thanks - rktucson
 
OK, here's another suggestion....

=Fill a 10x10 grid with =RAND() function. It can be anywhere on the worksheet, I chose D17:M26

Then, assuming your 4 names are in A2:A5 put this formula in D2 and copy across and down to M11

=LOOKUP(COUNTIF($D$17:$M$26,">"&D17),{0,25,50,75},$A$2:$A$5)

Now D2:M11 contains your 100 names, 25 of each randomly distributed

See below

Formula in B2 copied down is

=COUNTIF(D$2:M$11,A2)

This isn't necessary but it just checks that you have the correct number of each name
 
Upvote 0

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Sweet one barry! I haven't got the fogiest how it works - even evaluating the lookup formula - but work it does.
 
Upvote 0
@pgc:
As far as I understood the OP he wanted to fill a 10 cells by 10 cells square. How would your formula work for that set-up?

You are right, I read the post again and it seems rktucson wants the name in a rectangular grid. My formula would not work for that set-up. It would have to be modified and it would have to be much more complex. I believe it would only work in excel 2007 as I think I'd have to use more than the limit of nested function of previous releases. It would be an ugly formula, difficult to read and maintain and I would recommend against it. Unless I'm missing an easier solution.

Anyway, Barry posted a good solution. I also think your solution, with more auxilliary columns would work.

Cheers
 
Upvote 0
Anyway, Barry posted a good solution. I also think your solution, with more auxilliary columns would work.

Cheers

It works - Barry's is just far more elegant. I knew there must be some reason why Barry is a MVP and I am not. :D
 
Upvote 0

Forum statistics

Threads
1,216,494
Messages
6,130,977
Members
449,611
Latest member
Bushra

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