Excel generate random number based on array and condition

carissa7

New Member
Joined
Jan 13, 2018
Messages
8
Background: I have clients who get drug tested. They need to get drug tested 2x per a 7 day week. however, I don't want them finding out the pattern. So i want the pattern of numbers to change per every week. if someone gets tested monday and wednesday, then the following week they should get tested wednesday and friday.

Excel: As a result in excel I have an array of numbers lets say 1 through 65, to represent the patients. I have a formula that generates random numbers based on the array, for 10 columns. The data is present in 10 columns and 7 rows (sunday through sat (1 week)). Formula here: =RANDARRAY(A2:J8,10,1,65,TRUE). However I need each number / patient to get repeated / tested 2x per every week. I got the formula to generate 7 random numbers per day, based on the array. But what I don't know how to do is make sure the numbers are randomly generated every week with a different pattern.

Let me know if this makes sense.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I would take a different approach. In Column A, your 65 patients or their ID. In Column B, =RANDBETWEEN(1,7). In Column C =RANDBETWEEN(1,7)

Recalculate every week. The number 1 to 7 represent the day of the week. This then is random testing. If Column B and C have per chance the same number for a week, then bump one to the next day.
 
Upvote 0
I would take a different approach. In Column A, your 65 patients or their ID. In Column B, =RANDBETWEEN(1,7). In Column C =RANDBETWEEN(1,7)

Recalculate every week. The number 1 to 7 represent the day of the week. This then is random testing. If Column B and C have per chance the same number for a week, then bump one to the next day.
this works, but how do I make it so that it doesn't generate the same number in the two columns? what does "bump one to the next day mean" like just move it to the next day?
 
Upvote 0

Forum statistics

Threads
1,215,068
Messages
6,122,950
Members
449,095
Latest member
nmaske

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