Receiving an Error checking differences in time

Lyryx

New Member
Joined
Aug 18, 2015
Messages
45
Debrief
I'm putting together a workbook that checks the companies scheduling is in compliance with a few working standards regarding time, it seemed like an easy task at first but my formula seems to work sometimes but not others. I haven't worked with Time before in excel so it's a little unknown to me.


What I am trying to do
Create a formula that checks that there are 11 hours between the end time of the first shift and the start time of the second shift.

So if an Employee ends their Monday at 9:00pm, The earliest they should be working will be Tuesday at 8:00am.

My Code
I had thought something like this would work, but it only returns a value when the times are both "AM" or "PM"
Code:
=TEXT(E8-F7,"h:mm")
Where E8 = Start time of the next shift and F7 = End time of the current shift

Workbook Sample
*I didn't bother including the column with my formula from before as it is currently not working

[TABLE="width: 622"]
<tbody>[TR]
[TD]Employee # (C)[/TD]
[TD]Date (D)[/TD]
[TD]Start (E)[/TD]
[TD]End (F)[/TD]
[TD]Duration (G)[/TD]
[TD]Site (H)[/TD]
[/TR]
[TR]
[TD="align: right"]1204[/TD]
[TD]25-Apr-2016[/TD]
[TD="align: right"]7:15:00 AM[/TD]
[TD="align: right"]8:45:00 AM[/TD]
[TD]1:30[/TD]
[TD]CCAC[/TD]
[/TR]
[TR]
[TD="align: right"]1204[/TD]
[TD]25-Apr-2016[/TD]
[TD="align: right"]9:00:00 AM[/TD]
[TD="align: right"]12:00:00 PM[/TD]
[TD]3:00[/TD]
[TD]OUT[/TD]
[/TR]
[TR]
[TD="align: right"]1204[/TD]
[TD]27-Apr-2016[/TD]
[TD="align: right"]10:00:00 AM[/TD]
[TD="align: right"]11:00:00 AM[/TD]
[TD]1:00[/TD]
[TD]OUT[/TD]
[/TR]
[TR]
[TD="align: right"]1204[/TD]
[TD]27-Apr-2016[/TD]
[TD="align: right"]12:00:00 PM[/TD]
[TD="align: right"]1:00:00 PM[/TD]
[TD]1:00[/TD]
[TD]OUT[/TD]
[/TR]
[TR]
[TD="align: right"]1204[/TD]
[TD]28-Apr-2016[/TD]
[TD="align: right"]12:00:00 PM[/TD]
[TD="align: right"]1:00:00 PM[/TD]
[TD]1:00[/TD]
[TD]OUT[/TD]
[/TR]
[TR]
[TD="align: right"]1204[/TD]
[TD]29-Apr-2016[/TD]
[TD="align: right"]10:00:00 AM[/TD]
[TD="align: right"]11:00:00 AM[/TD]
[TD]1:00[/TD]
[TD]OUT[/TD]
[/TR]
[TR]
[TD="align: right"]1204[/TD]
[TD]29-Apr-2016[/TD]
[TD="align: right"]12:00:00 PM[/TD]
[TD="align: right"]1:00:00 PM[/TD]
[TD]1:00[/TD]
[TD]OUT[/TD]
[/TR]
[TR]
[TD="align: right"]1204[/TD]
[TD]02-May-2016[/TD]
[TD="align: right"]7:15:00 AM[/TD]
[TD="align: right"]8:45:00 AM[/TD]
[TD]1:30[/TD]
[TD]CCAC[/TD]
[/TR]
[TR]
[TD="align: right"]1204[/TD]
[TD]02-May-2016[/TD]
[TD="align: right"]9:00:00 AM[/TD]
[TD="align: right"]12:00:00 PM[/TD]
[TD]3:00[/TD]
[TD]OUT[/TD]
[/TR]
[TR]
[TD="align: right"]1204[/TD]
[TD]04-May-2016[/TD]
[TD="align: right"]10:00:00 AM[/TD]
[TD="align: right"]11:00:00 AM[/TD]
[TD]1:00[/TD]
[TD]OUT[/TD]
[/TR]
[TR]
[TD="align: right"]1204[/TD]
[TD]04-May-2016[/TD]
[TD="align: right"]12:00:00 PM[/TD]
[TD="align: right"]1:00:00 PM[/TD]
[TD]1:00[/TD]
[TD]OUT[/TD]
[/TR]
[TR]
[TD="align: right"]1204[/TD]
[TD]06-May-2016[/TD]
[TD="align: right"]10:00:00 AM[/TD]
[TD="align: right"]11:00:00 AM[/TD]
[TD]1:00[/TD]
[TD]OUT[/TD]
[/TR]
[TR]
[TD="align: right"]1204[/TD]
[TD]06-May-2016[/TD]
[TD="align: right"]12:00:00 PM[/TD]
[TD="align: right"]1:00:00 PM[/TD]
[TD]1:00[/TD]
[TD]OUT[/TD]
[/TR]
</tbody>[/TABLE]


Too Long Didn't Read
I need to write a formula that will tell me how much time is between the end time of the first shift and the start time of the next shift.


Thank you in advance :)
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hi, something like this maybe:


Excel 2013
ABCDEFGH
1Employee # (C)Date (D)Start (E)End (F)Duration (G)Site (H)
2120425-Apr-167:15:00 AM8:45:00 AM01:30CCAC
3120425-Apr-169:00:00 AM12:00:00 PM03:00OUT00:15< Custom Formatted as [hh]:mm
4120427-Apr-1610:00:00 AM11:00:00 AM01:00OUT46:00
5120427-Apr-1612:00:00 PM1:00:00 PM01:00OUT01:00
6120428-Apr-1612:00:00 PM1:00:00 PM01:00OUT23:00
7120429-Apr-1610:00:00 AM11:00:00 AM01:00OUT21:00
8120429-Apr-1612:00:00 PM1:00:00 PM01:00OUT01:00
9120402-May-167:15:00 AM8:45:00 AM01:30CCAC66:15
10120402-May-169:00:00 AM12:00:00 PM03:00OUT00:15
11120404-May-1610:00:00 AM11:00:00 AM01:00OUT46:00
12120404-May-1612:00:00 PM1:00:00 PM01:00OUT01:00
13120406-May-1610:00:00 AM11:00:00 AM01:00OUT45:00
14120406-May-1612:00:00 PM1:00:00 PM01:00OUT01:00
Sheet1
Cell Formulas
RangeFormula
G3=(B3+C3)-(B2+D2)
 
Upvote 0
This is definitely a step in the right direction, thank you every much!
I've attached it to an IF statement to check against the dates as well and it's exactly what I need thank you very much.


For anyone else using this as a guide, it should be noted that I needed to Reformat my cells using the formula to have it display the HH:MM instead of a decimal.


Thanks again FormR
 
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,432
Members
452,326
Latest member
johnshaji

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