choose random numbers from list excluding some, or automatically refresh formula until results ok

Cheeks1969

New Member
Joined
Dec 7, 2016
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Hi,
I have a list of 20 values in excel. I want to pick four by a certain rule, which I have figured out. Now I want to pick 6 randomly from the remaining 16.
I used 'randbetween' for the whole range of values (since I won't know ahead of time which 4 will be picked by the rules) along with a "duplicate?" function that says 'True' if any of the randomly chosen values match another randomly chosen value or one of the four chosen by the rules.

I'm curious if someone knows how to automatically refresh (f9- generate new random numbers) until they are all unique values - 'False' on the duplicate checker. Is there a way to do this with formulas only (no macros or arrays) ???

Alternatively, is there a way to choose randomly from a list while excluding certain cells that are previously chosen, but not known ahead of time, or what place they will be in the list?

Thanks in advance for any replies!
 
Sure:

Excel Formula:
=LET(a,FILTER(B2:B21,COUNTIF(A2:A10,B2:B21)=0),SORT(INDEX(SORTBY(a,RANDARRAY(ROWS(a))),SEQUENCE(D2))))
Awesome Eric. Thank You.
Note: You would definitely excel in creating some youtube videos in this field.
 
Upvote 0

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
I was surprised to see this thread come back to life. It took me a while to figure out why I asked this question but finally remembered and thought I would share it here.

I was working for a flood insurance company and wanted to use the coordinates from the perimeter of a building to find the most flood-vulnerable spot (using those coordinates to generate a flood risk score from a vendor), and also use some random spots from the remaining coordinates to generate the flood risk scores. The maxium score was identified and the coordinates that generated it were used to identify the spot. I would have then chosen from the rest randomly, but never finished because I believe we went another route. The point of choosing randomly would have been to see if any other spots generated a higher flood risk score, but 90% of the time it was a corner or the furthest point in one direction.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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