Samgraphics
Board Regular
- Joined
- Jan 9, 2022
- Messages
- 61
- Office Version
- 2011
- Platform
- MacOS
I'm hoping someone can help me, please. I have this formula that someone helped me with that chooses a random number from a range of numbers I give and prevents any repeats by using a helper table. I am wondering if it is possible to modify that formula so that it also checks the first random number chosen and chooses a number that is higher than the first number from the next range of numbers. I.e. if the first range of numbers is 2, 4, 5, 6, 7, 9, 11,10,13,14, 15, 17, and 10 was selected randomly in the first column and the second range of numbers are 7, 8, 10, 12, 13,14,15,16,17 then the next random number selected should be between 12 to 17. But as you may notice, 7, 10, 13, 14, 15, 17 are in both sets, so I would like it to still rand between these two sets but first check to see what the previous number is then select one that is higher than it. Here is a snippet with all the groups of numbers that the function chooses a random number from. Someone, please help me. Thank you.
Thank you so much
STATISTICAL NUMBER GENERATOR BY column ONLY 2022(B).xlsx | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
AF | AG | AH | AI | AJ | AK | AL | AM | AN | AO | AP | AQ | AR | AS | AT | |||
2 | 3 | 6 | 29 | 31 | 26 | 4 | 12 | 2 | 7 | 9 | 20 | 1 | 9 | ||||
3 | 1 | 15 | 10 | 26 | 29 | 1 | 6 | 4 | 7 | 12 | 21 | 3 | 2 | ||||
4 | 13 | 2 | 18 | 24 | 35 | 1 | 2 | 5 | 8 | 17 | 24 | 5 | 4 | ||||
5 | 7 | 14 | 19 | 25 | 34 | 7 | 2 | 5 | 10 | 17 | 24 | 7 | 6 | ||||
6 | 13 | 14 | 24 | 23 | 34 | 8 | 4 | 6 | 10 | 18 | 25 | 8 | 7 | ||||
7 | 16 | 20 | 30 | 28 | 24 | 3 | 4 | 7 | 12 | 18 | 25 | 10 | |||||
8 | 16 | 9 | 12 | 17 | 33 | 7 | 11 | 9 | 13 | 19 | 26 | 11 | |||||
9 | 1 | 22 | 18 | 24 | 21 | 8 | 10 | 11 | 14 | 20 | 28 | 12 | |||||
10 | 2 | 18 | 17 | 25 | 24 | 1 | 7 | 13 | 15 | 22 | 29 | ||||||
11 | 7 | 18 | 17 | 19 | 25 | 3 | 9 | 14 | 16 | 23 | 30 | ||||||
12 | 3 | 15 | 7 | 33 | 34 | 6 | 12 | 14 | 17 | 24 | 32 | ||||||
13 | 16 | 9 | 23 | 19 | 35 | 6 | 4 | 15 | 17 | 25 | 32 | ||||||
14 | 7 | 18 | 23 | 22 | 26 | 8 | 6 | 17 | 17 | 25 | 32 | ||||||
15 | 1 | 11 | 7 | 25 | 33 | 6 | 9 | 18 | 18 | 26 | 33 | ||||||
16 | 3 | 11 | 30 | 20 | 34 | 5 | 6 | 19 | 18 | 28 | 33 | ||||||
17 | 2 | 20 | 19 | 17 | 25 | 5 | 7 | 20 | 18 | 30 | 34 | ||||||
18 | 4 | 2 | 17 | 31 | 35 | 5 | 9 | 21 | 19 | 31 | 34 | ||||||
19 | 1 | 19 | 10 | 33 | 29 | 4 | 12 | 22 | 23 | 31 | 34 | ||||||
20 | 16 | 13 | 18 | 25 | 32 | 4 | 11 | 24 | 33 | 35 | |||||||
21 | 10 | 4 | 17 | 28 | 21 | 3 | 4 | 25 | 35 | ||||||||
22 | 3 | 14 | 12 | 33 | 30 | 4 | 12 | 27 | |||||||||
23 | 5 | 13 | 7 | 31 | 35 | 1 | 7 | 29 | |||||||||
24 | 16 | 20 | 10 | 17 | 33 | 1 | 12 | 30 | |||||||||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
AF2:AF24 | AF2 | =CHOOSE(RANDBETWEEN(1,10),1,1,RANDBETWEEN(2,3),4,5,7,8,10,13,16) |
AG2:AG24 | AG2 | =INDEX(AO$2:AO$19,AGGREGATE(15,6,(ROW(AO$2:AO$19)-ROW(AO$2)+1)/(COUNTIF($AF2,AO$2:AO$19)=0),RANDBETWEEN(1,SUMPRODUCT(--(COUNTIF($AF2,AO$2:AO$19)=0))))) |
AH2:AH24 | AH2 | =INDEX(AP$2:AP$24,AGGREGATE(15,6,(ROW(AP$2:AP$24)-ROW(AP$2)+1)/(COUNTIF($AF2:AG2,AP$2:AP$24)=0),RANDBETWEEN(1,SUMPRODUCT(--(COUNTIF($AF2:AG2,AP$2:AP$24)=0))))) |
AI2:AI24 | AI2 | =INDEX(AQ$2:AQ$20,AGGREGATE(15,6,(ROW(AQ$2:AQ$20)-ROW(AQ$2)+1)/(COUNTIF($AF2:AH2,AQ$2:AQ$20)=0),RANDBETWEEN(1,SUMPRODUCT(--(COUNTIF($AF2:AH2,AQ$2:AQ$20)=0))))) |
AJ2:AJ24 | AJ2 | =INDEX(AR$2:AR$21,AGGREGATE(15,6,(ROW(AR$2:AR$21)-ROW(AR$2)+1)/(COUNTIF($AF2:AI2,AR$2:AR$21)=0),RANDBETWEEN(1,SUMPRODUCT(--(COUNTIF($AF2:AI2,AR$2:AR$21)=0))))) |
AK2:AK24 | AK2 | =CHOOSE(RANDBETWEEN(1,7),1,3,4,5,6,7,8) |
AL2:AL24 | AL2 | =INDEX(AT$2:AT$9,AGGREGATE(15,6,(ROW(AT$2:AT$9)-ROW(AT$2)+1)/(COUNTIF($AK2,AT$2:AT$9)=0),RANDBETWEEN(1,SUMPRODUCT(--(COUNTIF($AK2,AT$2:AT$9)=0))))) |
Cells with Conditional Formatting | ||||
---|---|---|---|---|
Cell | Condition | Cell Format | Stop If True | |
AL2:AL100 | Expression | =OR($AL2=7,$AL2=10) | text | NO |
AK2:AK100 | Expression | =OR($AK2=8,$AK2=4) | text | NO |
AJ2:AJ100 | Expression | =OR($AJ2=25,$AJ2=29,$AJ2=30,$AJ2=33) | text | NO |
AI2:AI100 | Expression | =OR($AI2=9,$AI2=12,$AI2=19,$AI2=20,$AI2=22,$AI2=23,$AI2=24,$AI2=26,$AI2=30) | text | NO |
AH2:AH100 | Expression | =OR($AH2=8,$AH2=13,$AH2=14,$AH2=19,$AH2=23,$AH2=27,$AH2=28) | text | NO |
AG2:AG100 | Expression | =OR($AG2=4,$AG2=7,$AG2=9,$AG2=11,$AG2=13,$AG2=15,$AG2=19,$AG2=22) | text | NO |
AF2:AF100 | Expression | =OR($AF2=7,$AF2=5,$AF2=8,$AF2=13) | text | NO |
AL2:AL100 | Expression | =OR($AL2=9,$AL2=11,$AL2=12) | text | NO |
AK2:AK100 | Expression | =OR($AK2=1,$AK2=3,$AK2=5,$AK2=6,$AK2=7) | text | NO |
AJ2:AJ100 | Expression | =OR($AJ2=32,$AJ2=34,$AJ2=35) | text | NO |
AI2:AI100 | Expression | =OR($AI2=17,$AI2=18,$AI2=25,$AI2=31) | text | NO |
AH2:AH100 | Expression | =OR($AH2=7,$AH2=10,$AH2=16,$AH2=17,$AH2=18) | text | NO |
AG2:AG100 | Expression | =OR($AG2=5,$AG2=2,$AG2=14) | text | NO |
AF2:AF100 | Expression | =OR($AF2=1,$AF2=2,$AF2=3,$AF2=4,$AF2=16) | text | NO |
Thank you so much