Random Data with No Blanks and No Duplicates

HoneyBadger914

New Member
Joined
Aug 14, 2020
Messages
1
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
I am looking for a way to pull a random piece of data from a table, and skip the blanks and ensure there are no duplicates. The farthest I have gotten is by using <=INDEX('Sheet 1'!E8:G68,RANDBETWEEN(1,ROWS('Sheet 1'!E8:G68)),1), but this formula pulls the empty boxes. Not sure if this will pull duplicates, I haven't seen any yet. Thanks in advance!
 

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

jasonb75

Well-known Member
Joined
Dec 30, 2008
Messages
11,944
Office Version
  1. 365
Platform
  1. Windows
Not something that I've tried (I don't personally have office 365 to test the filter function) but one that comes to mind

=INDEX(FILTER('Sheet 1'!$E$8:$E$68,'Sheet 1'!$E$8:$E$68<>""),RANDBETWEEN(1,COUNTIF('Sheet 1'!$E$8:$E$68,"?*")))

You might need to enter it as a legacy array by using Ctrl Shift Enter to prevent it from trying to spill.
 

Toadstool

Well-known Member
Joined
Mar 5, 2018
Messages
1,292
Office Version
  1. 2016
Platform
  1. Windows
Hi HoneyBadger914,

Your formula should work though you'll need to add a randomization for columns also, e.g.
=INDEX($E$8:$G$68,RANDBETWEEN(1,ROWS($E$8:$E$68)),RANDBETWEEN(1,COLUMNS($E$8:$G$8)))

Yes, this will produce duplicates. Approximately 50% of the time you'll get a duplicate by the 10th execution.

I can only think of a kludgy way of addressing this with multiple work columns, I've only got Excel 2016, so probably @jasonb75 has the better approach.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,672
Messages
5,597,488
Members
414,146
Latest member
marginmakerb

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