Finding Max Value Combination with Two Constraints

LoPo87

New Member
Joined
Mar 22, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am trying to generate all combinations of sums taking 5 values from one set of numbers, and 1 value from another set of numbers, with an additional constraint. I am trying to determine the combinations of 5 "Drivers and 1 "Team" that will generate the highest sum of 'Value' with the constraint that the sum of their 'Salary' remains equal to or less than 100. Here is the data:

1616446752659.png


So my constraints are:
a.) Must use exactly 5 drivers
b.) Must use only 1 Team
c.) Salary sum of the 6 must be equal to or less than 100

Determine:
A list of all combinations such that I can sort by highest TOTAL VALUE given the 100 salary limit. It would be nice for each combination generated, to see what their respective salary sum is as well.

Any help would be appreciated!
 

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.
Welcome to the forum!

Here is the best solution I found using the Solver:

Book1
ABCDEFGHI
1Driver NameValueSalaryUse?Team NameValueSalaryUse?
2Hamilton40.8233.50Mercedes59.65380
3Verstappen26.8824.80Red Bull41.1225.90
4Bottas25.5923.61McLaren30.3518.90
5Ricciardo21.4117.31Aston Martin28.9417.60
6Perez18.7118.41Alpine28.1215.41
7Norris17.7113.11Ferrari21.5318.10
8Sainz15.8814.40AlphaTauri20.9412.70
9Alonso15.4115.60Alfa Romeo15.128.90
10Leclerc1416.80Williams10.416.30
11Gasly12.8211.71Haas9.596.10
12Raikkonen10.539.601
13Stroll10.5313.90
14Tsunoda9.298.80
15Ocon8.7610.10
16Vettel7.4716.20
17Giovinazzi6.067.90
18Latifi4.716.50
19Russell4.536.20
20Schumacker45.80
21Mazepin2.185.50ValueSalary
225124.3699.5
Sheet3
Cell Formulas
RangeFormula
I12I12=SUM(I2:I11)
D22D22=SUM(D2:D21)
F22F22=SUMPRODUCT(B2:B21,D2:D21)+SUMPRODUCT(G2:G11,I2:I11)
G22G22=SUMPRODUCT(C2:C21,D2:D21)+SUMPRODUCT(H2:H11,I2:I11)


1616448822437.png


The problem is that the Solver is not necessarily the best tool for this kind of problem, and the result might not actually be the best. And of course, it only gives 1 result, not the list you want. In the past I've written several macros that do what you want, only for baseball or football teams. Unfortunately, I don't have time to write one right now. Here's one that probably wouldn't be too hard to adapt if I had time:

 
Upvote 0

Forum statistics

Threads
1,214,611
Messages
6,120,509
Members
448,967
Latest member
screechyboy79

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