variable slot bookings how can this be achieved to show the cheapest cost?

deanmoakes

New Member
Joined
Dec 13, 2010
Messages
19
Hi All,

I am struggling with the best way to create the below
I have a column with hours of slots and the corresponding cost (all been randomly filled).
The box at the top has a time that can change (07:43:55).
I need the total at the bottom to be the most efficient in cost but still meeting the required time needed.

In this example it would be cheaper to book an 8 hr slot vs a number of smaller slots.

Any help would be appreciated

Eg
Target time
07:43:55​
ItemCostTimeTime balanceSlots bookedTime bookedCosts
120 hr
11200​
120:00:00​
7:43:55​
0​
0:00:00​
0​
24 hr
2600​
24:00:00​
7:43:55​
0​
0:00:00​
0​
8hr
950​
8:00:00​
7:43:55​
0​
0:00:00​
0​
3hr
400​
3:00:00​
7:43:55​
2​
6:00:00​
800​
1hr
150​
1:00:00​
1:43:55​
1​
1:00:00​
150​
15 min
40​
0:15:00​
0:43:55​
2​
0:30:00​
80​
1 min
3​
0:01:00​
0:13:55​
14​
0:14:00​
42​
7:44:00​
1072​
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
This looks like a Solver task. Your workbook is already pretty close to how you need to set it up. I added the formulas to it:

Book1 (version 1).xlsb
ABCDEFG
1Target time7:43:55
2
3ItemCostTimeTime balanceSlots bookedTime bookedCosts
4120 hr11200120:00:007:43:5500:00:000
524 hr260024:00:007:43:5500:00:000
68hr9508:00:00over18:00:00950
73hr4003:00:00over26:00:00800
81hr1501:00:00over00:00:000
915 min400:00:15over00:00:000
101 min30:00:01over00:00:000
11
1214:00:001750
Sheet17
Cell Formulas
RangeFormula
F4:F10F4=C4*E4
G4:G10G4=B4*E4
D4:D10D4=IFERROR(EXP(LN(C$1-SUMPRODUCT(C$4:C4,E$4:E4))),"over")
F12F12=SUMPRODUCT(E4:E10,C4:C10)
G12G12=SUMPRODUCT(E4:E10,B4:B10)


If you haven't yet, you can install the Solver by clicking on File > Options > Add-ins > Go (next to the Excel Add-ins box on the bottom) > and check the Solver Add-in box. Then go to the Data tab, click Solver (on the far right), and set up the parameters like this:

solver.jpg


Then click Solve. The Solver is not guaranteed to find the best answer, although it should get close. The only way to make sure you get the best answer is with a macro that checks all possibilities.
 
Upvote 0
Solution

Forum statistics

Threads
1,214,845
Messages
6,121,902
Members
449,053
Latest member
Guy Boot

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