Pick random rows from table

eaxlns

New Member
Joined
Apr 18, 2019
Messages
15
Office Version
  1. 365
Platform
  1. MacOS
Hello,
I would like to set up a formula so that it returns random rows from the below table.
I would need to return the corresponding columns as well, for example if it returns the value in A4 it would need to return the corresponding value in B4, C4 and D4 as well.

Card CodeRarityColourQuantity
610BK
Common

<tbody>
</tbody>
Blue
2
610BK
Uncommon

<tbody>
</tbody>
Red1
610BK
Legendary

<tbody>
</tbody>
Silver3
139WHCommonBlue1
139WHUncommonRed2
PL637

<tbody>
</tbody>
LegendaryGold1
PL637

<tbody>
</tbody>
CommonRed3
930PL

<tbody>
</tbody>
UncommonBlue2
930PL

<tbody>
</tbody>
LegendarySilver1

<tbody>
</tbody>
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Is this the sort of thing you mean.
Formula in F2 is stand-alone
Formula in G2 is copied across to column J
To get a new random row, just press F9

Excel Workbook
ABCDEFGHIJ
1Card CodeRarityColourQuantityIndexCard CodeRarityColourQuantity
2610BKCommonBlue23610BKLegendarySilver3
3610BKUncommonRed1
4610BKLegendarySilver3
5139WHCommonBlue1
6139WHUncommonRed2
7PL637LegendaryGold1
8PL637CommonRed3
9930PLUncommonBlue2
10930PLLegendarySilver1
11
Random Row
 
Last edited:
Upvote 0
That's great, thanks.
Is it possible to do Cell F2 without putting the number of rows in the formula, so instead of A2:A10, could we do A:A?
My data set varies on an hourly basis so it would save me some time to not have to change this number every time.
 
Upvote 0
Assuming there are no blank rows within your data, try this in F2

=RANDBETWEEN(1,COUNTA(A:A)-1)
 
Upvote 0
Yes, that works, thanks.
Taking this one step further, could the random value in column F be one which has not appeared in the previous row?
 
Upvote 0
Taking this one step further, could the random value in column F be one which has not appeared in the previous row?
That is considerably trickier, but try this.
F2 is copied down as far as you might ever need.
G2 is copied across to J and down as far as the column F formula.

Excel Workbook
ABCDEFGHIJ
1Card CodeRarityColourQuantityIndexCard CodeRarityColourQuantity
2610BKCommonBlue26139WHUncommonRed2
3610BKUncommonRed19930PLUncommonBlue2
4610BKLegendarySilver310930PLLegendarySilver1
5139WHCommonBlue18PL637CommonRed3
6139WHUncommonRed23610BKUncommonRed1
7PL637LegendaryGold17PL637LegendaryGold1
8PL637CommonRed35139WHCommonBlue1
9930PLUncommonBlue22610BKCommonBlue2
10930PLLegendarySilver14610BKLegendarySilver3
11
Random Row
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,549
Messages
6,120,149
Members
448,948
Latest member
spamiki

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