Macro/Solver to assign correctly the correct quantity of purchased apples

Antoniozarzal

New Member
Joined
Apr 25, 2016
Messages
9
Hello everybody

I will purchase a quantity of apples during the year, and 3 sellers made me their offers (quantity of apples and price per apple). Those offers are in sheets Seller 1, 2 and 3.

So I need to determine what is the best combination among those offers, purchasing at the lowest possible price while purchasing the required quantities.

I have been using Solver. I created 3 decision variables, which are a percentage that affects the total quantity of offered apples per seller. The objective is to minimize the $/apple. Constraints are: decision variables <=1 and Total purchased apples = Total required apples.

1588995908911.png
1588995457807.png


I got to the solution, partially. I'm having an issue when the sellers offer the same price for the apples and the sum of their offers makes exceed the required quantity of apples (I don't know how solver determines the results of the decision variables when this happens). And I need to be fair with the sellers, so, when this happens I need solver or a macro that:

1. Divides: Total apples required(after subtracting the best offer if there was any)/Sum the total of apples of sellers with the same price (for this example, sum of sellers 2 and 3).
2. Assing the result in 1) as the % of the decision variables of sellers 2 and 3.

1588996301880.png


I hope I have made myself understood. Thank you for your advice.

Antonio I.
 

Attachments

  • 1588995367652.png
    1588995367652.png
    39 KB · Views: 9
  • 1588995800085.png
    1588995800085.png
    40.4 KB · Views: 11

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

This is a link to the file if you want to watch it.
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,314
Members
452,634
Latest member
cpostell

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