Ok I've set up a solver model based on your uploaded file. To test you need to run the macro "Solver_loop". Before you can run this macro you must set a reference to solver (I assune solver is installed on your PC).
To set a reference to Solver click on "Developers" tap, then click on the "Visual Basic" icon and select "Tools" -> "References" and tick the box marked "Solver"
I've split you apple and orange to separate sheet one for apple and one for oranges.
Macro starts by clearin all data on these two sheets. Then it aplies autofilter to sheet1 in order to separate apples and oranges and result are copied to the appropriate sheet.
At the moment solver is set to match the number of boxes with the number of cans this is set by the line for apples
and
for oranges.
Below these lines are a green line i.e. not active at the moment. Difference is that the "Relation:=3" this part canges the setting from "equal to" to "equal or grater than".
I've tested the effect of this change and you will find the result on sheet2.
Alf
Bookmarks