I have a problem where I am trying to produce a certain number of units, however the available capacity does not allow all of the units to be produced each month and they need to be produced in order of their ranking from 1 through 6.
The ranking of the units to be produced changes from month to month. Example below:
Month 1 Total capacity - 150 units
Units able to be produced:
Site1 Product1 - 25 units
Site1 Product2 - 30 units
Site1 Product3 - 65 units
Site2 Product1 - 20 units
Site2 Product2 - 15 units
Site2 Product3 - 20 units
Unit product price:
Site1 Product1 Price - $7.13
Site1 Product2 Price - $4.28
Site1 Product3 Price - $2.67
Site2 Product1 Price - $4.30
Site2 Product2 Price - $2.11
Site2 Product3 Price - $1.09
Ranking based on product price:
Site1 Product1 - 1
Site1 Product2 - 3
Site1 Product3 - 4
Site2 Product1 - 2
Site2 Product2 - 5
Site2 Product3 - 6
Expected result:
Site1 Product1 - 25 units produced
Site1 Product2 - 30 units produced
Site1 Product3 - 65 units produced
Site2 Product1 - 20 units produced
Site2 Product2 - 10 units produced (plant capacity reached, only 10 of 15 units able to be produced)
Site2 Product3 - 0 units produced (plant capacity reached, 0 o 20 units able to be produced)
The above expected result section is where I am struggling to find a formula that will work.
The ranking of the units to be produced changes from month to month. Example below:
Month 1 Total capacity - 150 units
Units able to be produced:
Site1 Product1 - 25 units
Site1 Product2 - 30 units
Site1 Product3 - 65 units
Site2 Product1 - 20 units
Site2 Product2 - 15 units
Site2 Product3 - 20 units
Unit product price:
Site1 Product1 Price - $7.13
Site1 Product2 Price - $4.28
Site1 Product3 Price - $2.67
Site2 Product1 Price - $4.30
Site2 Product2 Price - $2.11
Site2 Product3 Price - $1.09
Ranking based on product price:
Site1 Product1 - 1
Site1 Product2 - 3
Site1 Product3 - 4
Site2 Product1 - 2
Site2 Product2 - 5
Site2 Product3 - 6
Expected result:
Site1 Product1 - 25 units produced
Site1 Product2 - 30 units produced
Site1 Product3 - 65 units produced
Site2 Product1 - 20 units produced
Site2 Product2 - 10 units produced (plant capacity reached, only 10 of 15 units able to be produced)
Site2 Product3 - 0 units produced (plant capacity reached, 0 o 20 units able to be produced)
The above expected result section is where I am struggling to find a formula that will work.