Random Number Generator Excluding Numbers Already in Cells

georgia92

New Member
Joined
Jul 18, 2023
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Hi! I am trying to allocate a number of records that each need to be reviewed by 3 people, and randomly allocate them as the primary, secondary, and tertiary reviewer.
So I need to randomly generate 1, 2 and 3 in a random order next to each record, but the numbers cannot double up (ie cannot be 1,1,3 - every record must have 1 2 and 3).

I have so far easily randomly allocated 1 2 or 3 in the first cell (RANDBETWEEN) and then in the second cell used =SMALL(IF(A1={1,2,3},"",{1,2,3}),RANDBETWEEN(1,2)) but I have having trouble figuring out to say " if 1 and 2 is present, then insert 3. If 1 and 3 are present, then insert 2. If 2 and 3 are present, then insert 1".

Sorry that is probably a terrible explanation but hopefully someone understands what I'm trying to do!
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Welcome to the Forum!

Here's one way you could do this:

Book8
ABCD
1
2312
3123
4321
5213
6231
7231
8132
9231
10132
Sheet1
Cell Formulas
RangeFormula
B2:B10B2=RANDBETWEEN(1,3)
C2:C10C2=1+MOD(B2+RANDBETWEEN(0,1),3)
D2:D10D2=6-SUM(B2:C2)
 
Upvote 0
If you wanted to go for a single formula for all of them you could try this one.

23 07 19.xlsm
ABCD
1
2Record 1132
3Record 2231
4Record 3123
5Record 4132
6Record 5132
Reviewers
Cell Formulas
RangeFormula
B2:D6B2=AGGREGATE(15,6,{1,2,3}/ISNA(MATCH({1,2,3},$A2:A2,0)),RANDBETWEEN(1,3-COUNT($A2:A2)))
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,956
Members
449,096
Latest member
Anshu121

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