PDA

View Full Version : Random Sequencing



victor222
01-09-2017, 11:21 AM
Hello all,


I am looking for help with this vba problem i have.


I have a system that accepts 3 types of demand in bulk. Each bulk has quantities in it. I have been able to split this quantities randomly from 1 to 5 splits before going into the system sequencially. But now i want these splits to go in a random sequence with no same type following each other.
For example


Type 1: 5 quantities; splitted into 2,3
Type 2: 7 quantities; splitted into 3,4
Type 3: 6 quantities; splitted into 1,1,1,1,2


And they go into the system in that sequence: 2,3,3,4,1,1,1,1,2


But i want to sequence to be random with no two of the same type following each other.


Please how can I achieve this with code.


Thanks

SamT
01-09-2017, 04:31 PM
That's a lot of code. And there are conditions that can make the second requirement impossible to meet. Ie. You receive two bulks and split them into 2 and 5 quantities.

Even if we develop code that will work with pure numbers, that doesn't mean it will work in your system of accepting demand in bulk.

If we can do this, you must provide much more information about the whole process.

victor222
01-09-2017, 06:08 PM
hello SamT,
thanks for your response, i am trying to upload an excel file for clarification but i don't seem to find where to upload it here.

victor222
01-09-2017, 06:42 PM
hello please find attached file for some clarification

thanks

victor222
01-10-2017, 08:25 AM
I created a process simulation using excel vba that chooses number of items from type 1 to number of types. I generate a random split between 2 and number of splits of each type. But the splits get executed sequentially from type 1, 2, ....


Is there a way to make split execute randomly with different results every time and doesn't repeat the same type except no split of other type left to randomise with. Also, first type not necessarily be the first to execute and the last not necessarily the last to execute.


I could't begin to think of what is the syntax to begin with.


For instance:
Type 1, 10 items of splits 2,1,2,5
Type 2, 5 items of splits 2,3
Type 3, 7 items of splits 2, 2, 3


Currently the process execute in (T1,2) (T1,1) (T1,2) (T1,5); (T2,2) (T2,3) ;(T3,2) (T3,2) (T3,3)
Intended process execution (T1, 2) (T2,2) (T1,1) (T3,2) (T2,3) (T1, 2) (T3, 2) (T1, 5) (T3, 3)

SamT
01-11-2017, 09:33 AM
Please do not start duplicate threads about the same problem.

Thank you.

p45cal
01-11-2017, 02:36 PM
See attached.

p45cal
01-11-2017, 02:49 PM
Oh groan… another chuffing cross poster.

http://www.mrexcel.com/forum/excel-questions/984572-random-sequencing.html
http://www.mrexcel.com/forum/excel-questions/984788-sequence-problem.html
http://www.msofficeforums.com/excel/33768-random-sequencing.html
http://www.excelforum.com/showthread.php?t=1169099&p=4557189#post4557189

SamT
01-11-2017, 08:30 PM
And two threads here.

We'll watch him. Closely.

@ victor222:
Read carefully and follow the link therein: What is multiposting? (http://www.vbaexpress.com/forum/faq.php?faq=new_faq_item#faq_new_faq_item3)

No more warnings.