Reputation: 9
I typed this in a cell =VLOOKUP(RANDBETWEEN(1,721),Players,1)
However it only gives me the position but not the corresponding player name and salary. How do I get randbetween to generate the whole row?
Position Name Salary
QB Peyton Manning 10700
QB Aaron Rodgers 10100
WR Calvin Johnson 9500
WR A.J. Green 9500
QB Drew Brees 9200
QB Matthew Stafford 9100
WR Julio Jones 9100
RB Marshawn Lynch 9000
Upvotes: 0
Views: 448
Reputation: 166331
Assuming the number being matched is in the first column of Players
and the next 3 columns are the ones you want to pull from:
{=VLOOKUP(RANDBETWEEN(1,721),Players,{2,3,4},1)}
Entered across 3 cells as an array formula (using Ctrl+Shift+Enter)
Upvotes: 1
Reputation: 103467
You could put =RANDBETWEEN(1,721)
in its own cell, then refer to that cell from each column. Example formulae:
A B C D
1 =RANDBETWEEN(1,721) =VLOOKUP($A1,Players,1) =VLOOKUP($A1,Players,2) =VLOOKUP($A1,Players,3)
2 =RANDBETWEEN(1,721) =VLOOKUP($A2,Players,1) =VLOOKUP($A2,Players,2) =VLOOKUP($A2,Players,3)
Etc..
Upvotes: 0