Elapsed Time in hours and minutes multiply by different rates

kremlin1313

New Member
Joined
May 8, 2015
Messages
4
ABCDE
1
COMPUTER NAME

<tbody>
</tbody>
TIME STARTED

<tbody>
</tbody>
TIME FINISHED

<tbody>
</tbody>
DurationAmount
2A
07:45:00 AM

<tbody>
</tbody>
10:00:00 AM

<tbody>
</tbody>
3B
4C

<tbody>
</tbody>


I need to display in column D the elapsed time between B and C columns in hh:mm. and the corresponding rates in column E.
Conditions:
IF D2 = 1, D2*15
IF D2 > 1, multiply the number of hours to 15(the rate per hour) plus the rates if below 1 hour
example if DURATION is 1 hour and 25 minutes, its should be $15+10= $25
If D2:
< 20 minutes, $5
> 20 minutes but < 40 minutes, $10
> 40 minutes but < 1 hour, $15
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Try this

D2 =24*(C2-B2) formatted [h]:mm

E2 =INT(D2*24)*15 + IF(MOD(D2*24,1)*60<=20,5,IF(AND(MOD(D2*24,1)*60>20,MOD(D2*24,1)*60<=40),10,15)) formatted as Currency
 
Upvote 0
Sorry but I have problem

http://postimg.org/image/n1jgv1crb/
comp_excel_time.jpg
[/URL][/IMG]

How to solve this?


the formula in D2 is =C2-B2
the formula in E2 =INT(D2*24)*15 + IF(MOD(D2*24,1)*60<=20,5,IF(AND(MOD(D2*24,1)*60>20,MOD(D2*24,1)*60<=40),10,15))
 
Last edited:
Upvote 0
Hi

Try in E2:-
Rich (BB code):
=INT(D2*24)*15+CEILING(MOD(MOD(D2,1)*1440,60),20)/20*5

hth
 
Upvote 0
THANK You Mike for your formula. I REALLY appreciate it but there's a problem. If the DURATION is 1 hr, it will return to $20, which is it adds $5. Also when the DURATION is 2hrs, it will return $35, which it adds again $5. It must be $15 per hour.
 
Upvote 0
If D2:
< 20 minutes, $5
> 20 minutes but < 40 minutes, $10
> 40 minutes but < 1 hour, $15

This doesn't cover a scenario where the minutes are exactly 20 or 40. What results do you expect if D2 = 1:20 or 1:40?

If you are always rounding up to the next 20 minutes try this formula

=CEILING(D2,"0:20")*24*15

format as currency
 
Last edited:
Upvote 0
THANK You Mike for your formula. I REALLY appreciate it but there's a problem. If the DURATION is 1 hr, it will return to $20, which is it adds $5. Also when the DURATION is 2hrs, it will return $35, which it adds again $5. It must be $15 per hour.

Sorry, try this :-
Code:
=INT(MOD(D2,1)*24)*15+(((CEILING(MOD(MOD(D2,1)*1440,60),20)/20)-(INT(MOD(D2,1)*1440)/60=ROUND(MOD(D2,1)*24,2)))*5)
 
Upvote 0

Forum statistics

Threads
1,215,616
Messages
6,125,860
Members
449,266
Latest member
davinroach

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