Seperating hours from a range of time.

BigRobCoUk

New Member
Joined
Nov 4, 2015
Messages
4
Hello All,

I have in the past found loads of help from other posts on this site, but I am a bit stumped now.

I am trying to create a timesheet that can calculate a shift whether that be a day shift or a night shift that spans midnight. Giving the total hours (this is the easy bit for me)

But....

Then creating seperate hours based on the time of day that they are in.

For instance

Date
Work
Leave
Standby
Start
Finish
BreakHours
x1
x1.5
x2
Call OutDescription of tasks
Thu 01 Feb 201813:0003:0000:3013:3006:3003:00
04:00

<colgroup><col><col span="2"><col><col><col><col><col><col><col><col><col><col></colgroup><tbody>
</tbody>

Where column x1 are the hours from 0600-2000
column x1.5 are the hours from 2000-2300
column x2 are the hours from 2300-0600

The break column will always be deducted from the x1 rate column also.

Is anyone able to put me on the right track for this.

Your help would be much appreciated.

Thanks in advance.

Rob
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
x1
=MEDIAN(6/24,F2+(F2< E2),20/24)-MEDIAN(6/24,E2,20/24)-G2


x1.5
=MEDIAN(20/24,F2+(F2< E2),23/24)-MEDIAN(20/24,E2,23/24)


x2
=MEDIAN(23/24,F2+(F2< E2),30/24)-MEDIAN(23/24,F2,30/24)
 
Last edited:
Upvote 0
Correction: x2 should be this...

=MEDIAN(23/24,F2+(F2< E2),30/24)-MEDIAN(23/24,E2,30/24)
 
Upvote 0
x1
=MEDIAN(6/24,F2+(F2< E2),20/24)-MEDIAN(6/24,E2,20/24)-G2


x1.5
=MEDIAN(20/24,F2+(F2< E2),23/24)-MEDIAN(20/24,E2,23/24)


x2
=MEDIAN(23/24,F2+(F2< E2),30/24)-MEDIAN(23/24,F2,30/24)


Thanks AlphaFrog for a quick response.

I have tried the formula,

Can you please help when I put in the start time from 00:00 to 24:00 it doesnt seem to calculate and of the x2 hours on that column.

Thanks again
 
Upvote 0
Can you please help when I put in the start time from 00:00 to 24:00 it doesnt seem to calculate and of the x2 hours on that column.


Not sure what you are asking.

Don't use 24:00 as a start-time. That's not consistent with how you enter end-times that do not indicate they are on the next day.
 
Last edited:
Upvote 0

Date
WorkLeaveStandbyStartFinishBreakHoursx1x1.5x2Call OutDescription of tasks
Thu 01 Feb 201801:0023:0000:3021:3013:3003:0000:00
Fri 02 Feb 201807:0019:0000:3011:3011:3000:0000:00
Sat 03 Feb 201812:0000:0000:3011:3007:3003:0000:00
Sun 04 Feb 201822:0003:0000:3004:30####01:0004:00
Mon 05 Feb 201819:0001:0000:3005:3000:3003:0002:00
Tue 06 Feb 201807:0017:00
00:3009:3009:3000:0000:00
Wed 07 Feb 201807:0017:0000:3009:3009:3000:0000:00
Thu 08 Feb 201807:0017:0000:3009:3009:3000:0000:00

<tbody>
</tbody>

Hi AlphaFrog,

What I am trying to say is that is is not calculating the hour between 2300 and 2400 on the sheet in the x2 column.

Also when a time is calculated over the midnight time the times are not adding up. the combine x1, x1.5 and x2 should equal the total hours in column H.

I have filled in some example shifts into the sheet above.

Thanks
 
Upvote 0
x1
=IF(E2 > 20/24,0,MEDIAN(6/24,F2+(F2< E2),20/24)-MEDIAN(6/24,E2,20/24)-G2)


x1.5 (if x1 is zero, the Break is subtracted here)
=MEDIAN(20/24,F2+(F2< E2),23/24)-MEDIAN(20/24,E2,23/24)-(G2*(I2=0))


x2
=IF(E2< 6/24,MEDIAN(0,F2,6/24)-MEDIAN(0,E2,6/24), MEDIAN(23/24,F2+(F2< E2),30/24)-MEDIAN(23/24,E2,30/24))
 
Upvote 0
AlphaFrog,

You are a star, thanks for doing this for me. It works a treat.

I have no idea how but it does. I think I'm going to have to get some excel training under my belt. The last 'intermediate' one I done at work taught us how to use ctrl+v and p instead of right clicking. lol.

Although I think I am a bit past that stage I now know there is a lot more to learn for me...

Thanks again.

Rob
 
Upvote 0

Forum statistics

Threads
1,215,706
Messages
6,126,334
Members
449,309
Latest member
kevinsucher

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