I'm working on developing a simulation model in Excel for a class project, and I have ran across this odd problem. My model is basically to simulate a tram path with multiple stations. To make it simpler, I have created this Excel sheet to demonstrate my model and issue:
As you can see above, this is the information of riders who are arriving at station 1 and wanting to go to station 2, 3 and 4 respectively.
In the cells B3 to D3, I have this formula:
=ROUND(BETA.INV(RAND(), 4, 4, 0,6),0)
In the cell B4, I have this formula:
=IF($E$3>8,IF(B3=0,0,RANDBETWEEN(1,B3)),B3)
and finally, in the cells B6, I have:
=B3 - B4
Now, the tram capacity is only 8 riders at a time, so the total number in cell E4 cannot exceed 8. Is there a way I can tell Excel to do the following:
- If the total number of people in cell E3 is greater than 8, then randomly select numbers of riders who can get on the tram based on the number of riders who want to go to each station so long that the total number in cell E4 does NOT exceed 8 (just as demonstrated in the screenshot above).
- If the total number of people in cell E3 is less than or equal to 8, then the same number in cells B3 - D3 should carry over to cells B4 - D4.
Hopefully my explanation is clear enough. Any thoughts on how to achieve this?
Thanks!
Aucun commentaire:
Enregistrer un commentaire