Time computation

Franco88

New Member
Joined
Dec 27, 2022
Messages
3
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Need assistance to troubleshoot calculating beetween times in columns a1 and b1.


First 3 hours 50
succeeding 10 thereafter (after 3 hours)
and 200 for every 24 hours period

Thank you

Book2
ABCD
1TIME INTIME OUTDURATION HOURSCHARGE
213:5422:549:0051.625
314:5423:549:0051.625
415:540:549:0051.625
516:541:549:0051.625
Sheet1
Cell Formulas
RangeFormula
C2:C5C2=B2-A2
D2:D5D2=IF(C2<=TIME(3,0,0)*50,50+(C2+TIME(3,0,0)*10))
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Can you show the calculations and expected results for a variety of times?

A guess follows

Time.xlsm
ABCD
1TIME INTIME OUTDURATION HOURSCHARGE
213:54:0022:54:009.00110
314:54:0016:54:002.00
413:54:000:54:0011.00
516:54:5916:54:5824.00460
6
11c
Cell Formulas
RangeFormula
D2D2=(C2>3)*50+(C2-3)*10+(C5=24)
C2:C5C2=(B2-A2+(A2>B2))*24
D5D5=(C5>3)*50+(CEILING(C5,0.05)-3)*10+(CEILING(C5,0.05)=24)*200
 
Upvote 0
Wow, thank you for your prompt response, Kindly see the sample below

Book1
ABCDEFGHIJ
1TIME INTIME OUTDURATION HOURSEXPECTED RESULTSTotal HoursInitial FeeOvernight every 24 hoursTOTAL
212/28/2022 13:5412/28/2022 22:549.00110.0015050
312/28/2022 15:5812/28/2022 16:591.0250.00250
412/28/2022 16:5412/28/2022 19:543.0050.00350
512/28/2022 20:2312/28/2022 23:593.6060.0046060
612/28/2022 11:0012/28/2022 23:5912.98150.0057070
712/28/2022 13:5812/29/2022 13:5824.00460.0068080
812/28/2022 13:5412/29/2022 13:5524.02470.0079090
98100100
109110110
1110120120
1211130130
1312140140
1413150150
1514160160
1615170170
1716180180
1817190190
1918200200
2019210210
2120220220
2221230230
2322240240
2423250250
2524260200460
2625270200470
Sheet1
Cell Formulas
RangeFormula
C2:C8C2=(B2-A2+(A2>B2))*24
 
Upvote 0
How about this?
D2=
Excel Formula:
=VLOOKUP(ROUNDUP(C2,0),$G$2:$J$26,4,1)
 
Upvote 0
Time.xlsm
ABCD
1TIME INTIME OUTDURATION HOURSEXPECTED RESULTS
213:5422:549110
315:5816:59150
416:5419:54350
520:2323:59460
611:0023:5913150
713:5813:5824460
828-12-22 13:5829-12-22 14:5825470
9
11c
Cell Formulas
RangeFormula
C2:C7C2=ROUND((B2-A2+(A2>B2))*24,0)
D2:D8D2=(C2>0)*50+(C2>3)*(C2-3)*10+(C2>=24)*200
C8C8=ROUND((B8-A8)*24,0)
 
Last edited:
Upvote 0
N.B.
The first post had just time; the later post had both date and time.
I changed the time on cell B8.
Use the rounding or ceiling formula that is correct for your requirements.

Time.xlsm
ABCD
1TIME INTIME OUTDURATION HOURSEXPECTED RESULTS
228-Dec-22 13:5428-Dec-22 22:549110
328-Dec-22 15:5828-Dec-22 16:59150
428-Dec-22 16:5428-Dec-22 19:54350
528-Dec-22 20:2328-Dec-22 23:59460
628-Dec-22 11:0028-Dec-22 23:5913150
728-Dec-22 13:5829-Dec-22 13:5824460
828-Dec-22 13:5429-Dec-22 14:5525470
9
11cc
Cell Formulas
RangeFormula
C2:C8C2=ROUND((B2-A2)*24,0)
D2:D8D2=(C2>0)*50+(C2>3)*(C2-3)*10+(C2>=24)*200
 
Upvote 0
N.B.
The first post had just time; the later post had both date and time.
I changed the time on cell B8.
Use the rounding or ceiling formula that is correct for your requirements.

Time.xlsm
ABCD
1TIME INTIME OUTDURATION HOURSEXPECTED RESULTS
228-Dec-22 13:5428-Dec-22 22:549110
328-Dec-22 15:5828-Dec-22 16:59150
428-Dec-22 16:5428-Dec-22 19:54350
528-Dec-22 20:2328-Dec-22 23:59460
628-Dec-22 11:0028-Dec-22 23:5913150
728-Dec-22 13:5829-Dec-22 13:5824460
828-Dec-22 13:5429-Dec-22 14:5525470
9
11cc
Cell Formulas
RangeFormula
C2:C8C2=ROUND((B2-A2)*24,0)
D2:D8D2=(C2>0)*50+(C2>3)*(C2-3)*10+(C2>=24)*200


Thank you so much.
One more thing to test is how to adapt a formula that takes 1 minute to change into an hour (fraction thereof)

e.g.
3.02 = 4 hrs
4.01= 5 hrs
24.01 = 25 hrs
 
Upvote 0

Forum statistics

Threads
1,214,913
Messages
6,122,207
Members
449,074
Latest member
cancansova

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