Solver to find the most possible options with out going over.

AWM21

New Member
Joined
Aug 2, 2021
Messages
13
Office Version
  1. 365
Platform
  1. Windows
Hello, thank you for looking at this with me.

I have 13 options and I need to select the highest count of these options, where their items costs totals cannot exceed a fixed number. (168) in this example.
Out of the options below, the goal is to include as many options without exceeding the fixed total. The totals can fall short of 168, just not exceed.

I used solver, but solver gets me the least amount of options to include, I need the most.

here is my data. Thanks again!

Book1.xlsx
BCDEFGHIJ
8
9Opt 0180180Total of all options760
10Opt 0263163Opt items totals cannot exceed168
11Opt 0318118Difference between above592
12Opt 0480180
13Opt 0536136
14Opt 0680180
15Opt 0760160
16Opt 0880180
17Opt 0980180
18Opt 1080180Total post Solver solution760
19Opt 1154154
20Opt 1221121
21Opt 1328128
22
Sheet1
Cell Formulas
RangeFormula
I9I9=SUM(F9:F21)
I11I11=I9-I10
I18I18=SUM(F9:F21)
F9:F21F9=E9*D9
Named Ranges
NameRefers ToCells
solver_adj=Sheet1!$E$9:$E$21F9
solver_lhs1=Sheet1!$E$9:$E$21F9
solver_lhs2=Sheet1!$E$9:$E$21F9
solver_lhs3=Sheet1!$E$9:$E$21F9
solver_rhs4=Sheet1!$I$10I11


1671846019239.png


Book1.xlsx
BCDEFGHIJ
8
9Opt 018000Total of all options168
10Opt 026300Opt items totals cannot exceed168
11Opt 031800Difference between above0
12Opt 048000
13Opt 053600
14Opt 068000
15Opt 0760160
16Opt 088000
17Opt 098000
18Opt 1080180Total post Solver solution168
19Opt 115400
20Opt 122100
21Opt 1328128
22
Sheet1
Cell Formulas
RangeFormula
I9I9=SUM(F9:F21)
I11I11=I9-I10
I18I18=SUM(F9:F21)
F9:F21F9=E9*D9
Named Ranges
NameRefers ToCells
solver_adj=Sheet1!$E$9:$E$21F9
solver_lhs1=Sheet1!$E$9:$E$21F9
solver_lhs2=Sheet1!$E$9:$E$21F9
solver_lhs3=Sheet1!$E$9:$E$21F9
solver_rhs4=Sheet1!$I$10I11
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Is this what you want?

22 12 24.xlsm
CDEFGHI
9Opt 018000Total of all options163
10Opt 026300Opt items totals cannot exceed168
11Opt 0318118Difference between above-5
12Opt 048000Options used5
13Opt 0536136
14Opt 068000
15Opt 0760160
16Opt 088000
17Opt 098000
18Opt 108000
19Opt 115400
20Opt 1221121
21Opt 1328128
Solver
Cell Formulas
RangeFormula
I9I9=SUM(F9:F21)
I11I11=I9-I10
I12I12=SUM(E9:E21)
F9:F21F9=E9*D9


1671857345543.png
 
Upvote 0
Solution
Is this what you want?

22 12 24.xlsm
CDEFGHI
9Opt 018000Total of all options163
10Opt 026300Opt items totals cannot exceed168
11Opt 0318118Difference between above-5
12Opt 048000Options used5
13Opt 0536136
14Opt 068000
15Opt 0760160
16Opt 088000
17Opt 098000
18Opt 108000
19Opt 115400
20Opt 1221121
21Opt 1328128
Solver
Cell Formulas
RangeFormula
I9I9=SUM(F9:F21)
I11I11=I9-I10
I12I12=SUM(E9:E21)
F9:F21F9=E9*D9


View attachment 81516

Thanks Peter! that works!
Looks like I was referencing the wrong cell for my objective, and I needed to select "Max" instead of defining a value.
Thanks again!!
 
Upvote 0
You're welcome. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,215,084
Messages
6,123,029
Members
449,092
Latest member
ikke

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