Help with a formula.

Samgraphics

Board Regular
Joined
Jan 9, 2022
Messages
61
Office Version
  1. 2011
Platform
  1. 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.
STATISTICAL NUMBER GENERATOR BY column ONLY 2022(B).xlsx
AFAGAHAIAJAKALAMANAOAPAQARASAT
2362931264122792019
31151026291647122132
41321824351258172454
571419253472510172476
6131424233484610182587
7162030282434712182510
8169121733711913192611
91221824218101114202812
102181725241713152229
117181719253914162330
123157333461214172432
131692319356415172532
147182322268617172532
15111725336918182633
163113020345619182833
172201917255720183034
18421731355921193134
1911910332941222233134
201613182532411243335
21104172821342535
2231412333041227
23513731351729
24162010173311230
Sheet1
Cell Formulas
RangeFormula
AF2:AF24AF2=CHOOSE(RANDBETWEEN(1,10),1,1,RANDBETWEEN(2,3),4,5,7,8,10,13,16)
AG2:AG24AG2=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:AH24AH2=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:AI24AI2=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:AJ24AJ2=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:AK24AK2=CHOOSE(RANDBETWEEN(1,7),1,3,4,5,6,7,8)
AL2:AL24AL2=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
CellConditionCell FormatStop If True
AL2:AL100Expression=OR($AL2=7,$AL2=10)textNO
AK2:AK100Expression=OR($AK2=8,$AK2=4)textNO
AJ2:AJ100Expression=OR($AJ2=25,$AJ2=29,$AJ2=30,$AJ2=33)textNO
AI2:AI100Expression=OR($AI2=9,$AI2=12,$AI2=19,$AI2=20,$AI2=22,$AI2=23,$AI2=24,$AI2=26,$AI2=30)textNO
AH2:AH100Expression=OR($AH2=8,$AH2=13,$AH2=14,$AH2=19,$AH2=23,$AH2=27,$AH2=28)textNO
AG2:AG100Expression=OR($AG2=4,$AG2=7,$AG2=9,$AG2=11,$AG2=13,$AG2=15,$AG2=19,$AG2=22)textNO
AF2:AF100Expression=OR($AF2=7,$AF2=5,$AF2=8,$AF2=13)textNO
AL2:AL100Expression=OR($AL2=9,$AL2=11,$AL2=12)textNO
AK2:AK100Expression=OR($AK2=1,$AK2=3,$AK2=5,$AK2=6,$AK2=7)textNO
AJ2:AJ100Expression=OR($AJ2=32,$AJ2=34,$AJ2=35)textNO
AI2:AI100Expression=OR($AI2=17,$AI2=18,$AI2=25,$AI2=31)textNO
AH2:AH100Expression=OR($AH2=7,$AH2=10,$AH2=16,$AH2=17,$AH2=18)textNO
AG2:AG100Expression=OR($AG2=5,$AG2=2,$AG2=14)textNO
AF2:AF100Expression=OR($AF2=1,$AF2=2,$AF2=3,$AF2=4,$AF2=16)textNO


Thank you so much
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

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