I tried searching high and low for an answer on this. I am trying to return the maximum value of an item under a particular spending threshold. So I have a sheet that has 3 products a budget and a cumulative costs. I need it to tell me the most of each of the products I can get as close to that budget amount as possible. In the example below I would need it to tell me 6 Pants, 7 Shirts, 2 Socks.
<tbody>
</tbody>
A | B | C | D | E | F | G | H | I | |
1 | Product | Current Qty | Max Qty | Budget | Product | Qty | Cumulative Cost | ||
2 | Shirts | 0 | 205 | Pants | 1 | 20 | |||
3 | Pants | 0 | Shirts | 1 | 30 | ||||
4 | Socks | 0 | Pants | 2 | 50 | ||||
5 | Shirts | 2 | 60 | ||||||
6 | Shirts | 3 | 70 | ||||||
7 | Pants | 3 | 90 | ||||||
8 | Socks | 1 | 95 | ||||||
9 | Shirts | 4 | 105 | ||||||
10 | Pants | 4 | 125 | ||||||
11 | Shirts | 5 | 135 | ||||||
12 | Pants | 5 | 155 | ||||||
13 | Shirts | 6 | 165 | ||||||
14 | Socks | 2 | 170 | ||||||
15 | Pants | 6 | 190 | ||||||
16 | Shirts | 7 | 200 | ||||||
17 | Pants | 7 | 220 | ||||||
18 | Shirts | 8 | 230 | ||||||
19 | Socks | 3 | 235 | ||||||
<tbody>
</tbody>