Count spesific time within two time range

iraqiboy90

New Member
Joined
Aug 15, 2017
Messages
2
Hi

I'm having hard time figuring out how to auto calculate the following in excel

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]From[/TD]
[TD]To[/TD]
[TD]Total[/TD]
[TD]12%[/TD]
[TD]50%[/TD]
[/TR]
[TR]
[TD]23:00[/TD]
[TD]07:00[/TD]
[TD]8[/TD]
[TD]2[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]15:00[/TD]
[TD]23:00[/TD]
[TD]8[/TD]
[TD]8[/TD]
[TD]0[/TD]
[/TR]
</tbody>[/TABLE]

So this is a work timetable where we get 12% extra if it's between 06:00 and 24:00
We get 50% extra for the time between 24:00 and 06:00

Now, I got the total formula figured out using =(07-23+(07<23))*24
but not the 12% or the 50%
Idk how to auto calculate the time between 24:00-06:00 and 06:00-24:00


Regards
iraqiboy90
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Pasting your table into A1:E3 place in C2:

=(B2-A2+(A2>B2))*24

In D2:

=IF(A2>B2,"24:00"-A2+MAX(B2,"6:00")-"6:00",B2-MAX(A2,"6:00"))*24

In E2:

=C2-D2

Copy down.
 
Upvote 0
For 12%

Code:
=SUMPRODUCT(--((MOD((A2+(ROW(INDIRECT("1:"&C2))-1)/24),1)>=(6/24)))*((MOD((A2+(ROW(INDIRECT("1:"&C2))-1)/24),1)<(23.999/24))))

For 50 %

Code:
=SUMPRODUCT(--((MOD((A2+(ROW(INDIRECT("1:"&C2))-1)/24),1)>=0))*((MOD((A2+(ROW(INDIRECT("1:"&C2))-1)/24),1)<(6/24))))
 
Upvote 0

Forum statistics

Threads
1,224,789
Messages
6,180,957
Members
453,009
Latest member
lorbieckit

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