Populate table (25 cells) randomly with list of 5 people

cRx45

New Member
Joined
May 17, 2013
Messages
22
I've searched the forum for this but can't find it. If the answer exists please point me to the right thread.

I have a list of 5 people who I want to randomly put in a table consisting of columns Mon - Friday and rows for Week 1-5 (so 25 blank cells).

How do I go about randomly filling those 25 cells with the 5 people?

I can randomize the 5 people from 1 - 5 using the rand() & rank() formulae, but can't work out how/if to use them to fill the table randomly with those 5 people.

Any ideas?

Hope that made sense.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

tusharm

MrExcel MVP
Joined
May 28, 2002
Messages
11,029
Several options at Random Selection
I've searched the forum for this but can't find it. If the answer exists please point me to the right thread.

I have a list of 5 people who I want to randomly put in a table consisting of columns Mon - Friday and rows for Week 1-5 (so 25 blank cells).

How do I go about randomly filling those 25 cells with the 5 people?

I can randomize the 5 people from 1 - 5 using the rand() & rank() formulae, but can't work out how/if to use them to fill the table randomly with those 5 people.

Any ideas?

Hope that made sense.
 
Upvote 0

cRx45

New Member
Joined
May 17, 2013
Messages
22
Here's what I'm trying to do:

Not sure if Columns A or C are needed to fill in cells F2:J6 :confused:

Excel 2016 (Windows) 32 bit
ABCDEFGHIJ
1RankNameRandMonTuesWedThurFri
22Person 10.325Week 1#N/A#N/A#N/A#N/A#N/A
31Person 20.041Week 2#N/A#N/A#N/A#N/A#N/A
43Person 30.393Week 3#N/A#N/A#N/A#N/A#N/A
5Week 4#N/A#N/A#N/A#N/A#N/A
6Week 5#N/A#N/A#N/A#N/A#N/A

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
F2=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
G2=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
H2=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
I2=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
J2=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
F3=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
G3=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
H3=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
I3=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
J3=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
F4=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
G4=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
H4=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
I4=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
J4=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
F5=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
G5=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
H5=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
I5=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
J5=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
F6=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
G6=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
H6=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
I6=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
J6=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
A2=IFERROR(RANK(C2,C$2:C$4,1), "")
A3=IFERROR(RANK(C3,C$2:C$4,1), "")
A4=IFERROR(RANK(C4,C$2:C$4,1), "")

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0

tusharm

MrExcel MVP
Joined
May 28, 2002
Messages
11,029
It is relevant...here's how...

In F2:J6 enter the formula =RAND()

In L2 enter the formula =RANK.EQ(F2,$F2:$J2).
Copy L2 to the rest of L2:P6.

In R2 enter the formula =INDEX($B$2:$B$6,L2)
Copy R2 to the rest of R2:U6.

If you want, you could combine the formulas in L:P and R:U but the above is easier to understand.


Here's what I'm trying to do:

Not sure if Columns A or C are needed to fill in cells F2:J6 :confused:

Excel 2016 (Windows) 32 bit
ABCDEFGHIJ
1RankNameRandMonTuesWedThurFri
22Person 10.325Week 1#N/A#N/A#N/A#N/A#N/A
31Person 20.041Week 2#N/A#N/A#N/A#N/A#N/A
43Person 30.393Week 3#N/A#N/A#N/A#N/A#N/A
5Week 4#N/A#N/A#N/A#N/A#N/A
6Week 5#N/A#N/A#N/A#N/A#N/A

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
F2=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
G2=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
H2=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
I2=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
J2=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
F3=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
G3=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
H3=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
I3=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
J3=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
F4=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
G4=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
H4=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
I4=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
J4=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
F5=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
G5=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
H5=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
I5=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
J5=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
F6=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
G6=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
H6=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
I6=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
J6=VLOOKUP(RAND(), $A$1:$B$4, 2, TRUE)
A2=IFERROR(RANK(C2,C$2:C$4,1), "")
A3=IFERROR(RANK(C3,C$2:C$4,1), "")
A4=IFERROR(RANK(C4,C$2:C$4,1), "")

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0

cRx45

New Member
Joined
May 17, 2013
Messages
22
Oh wow! That worked perfectly.

I didn't think of it in that way with the 2 helper tables.

Thank you very much.
 
Upvote 0

Forum statistics

Threads
1,191,025
Messages
5,984,198
Members
439,877
Latest member
kellylet

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
Top