Hi I have a looping code problem I was wondering if you could have a quick look for me.
I have two tables of information. The first is a matrix with some distances. The second is a table of distribution. Ive been trying this for a long time now with limited success using a truth table but i've realised the only way to do this is in code. Ive got limited experience with this so please point me in the right direction.
Ive written some steps explaining what each table does here -
Step 1 Check for lowest value B4:F4 in Table 1 (in example is 10)
Step 2 Check corresponding column destination available capacity in table 2 (Example 500)
Step 3 Distribute as much as possible from source in table 2 (500)
Step 4 Reduce value in capacity line by value taken from source
Step 5 If some source remains move back to table 1 and find next nearest column Dest
Step 6 Repeat step 2 until all source is gone in row
Step 7 Check for lowest value B5:F5 in Table 1
if run out of capacity at all sites stop code
etc
until Table 1 column B is empty
Ive posted a spreadsheet with some before and after tables in it aswell. Its very small and formatted o its easy to see whats happening.
Thanks for taking a look.
Bookmarks