Forum Discussion
Anthony_User
Jul 13, 2022Copper Contributor
Solver Inquiry - Excel
Hey - trying to run parameters in solver where the result would be the 2 highlighted values showing 1 and 1 since they equate to Value of 9029. Do you know what I am doing wrong? Thanks ...
JoeUser2004
Jul 13, 2022Bronze Contributor
The formula in the B8 is =SUMPRODUCT(B2:B6, C2:C6).
Note that the By Changing range is C2:C6, not including B2:B6. The same with range for the binary constraint.
You could Set Objective to B8 and set To Value Of 9029, as you did.
But I think it is more flexible to enter the goal value in Excel, as you did in D2. Then Set Objective to B9 and To Value Of 0, where B9 is the formula =B8-D2, as shown.
BTW, in case equality is not possible, a more flexible set-up is to set B9 To Max, with the constraint B9<=0.
To demonstrate, set B8 to 9020. Solver selects 1568 and 7282, for a total of 8850 in B8, which is 170 less than 9020 (-170 in B9).
PS.... I had not see OliverScheurich's solution before I clicked Post.
Anthony_User
Jul 13, 2022Copper Contributor
thank you!