Calculating time difference per task over 2 days

Jess9898

New Member
Joined
Oct 1, 2021
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
Hi,
I am trying to figure out how to find the difference between two task times as long as their ID number is the same. This is for different shifts/days so when their shifts ends at 3AM and starts back at 4PM the next day I don't want to take the 12 hour time difference - I want it to say 0. I also don't want a negative time error when it switches over to midnight the next day. Attached are 2 screens shots to get a better idea of what I'm asking.

At the most basic form, I have this =IF(E5=E4,C5-C4,0)

B = Date
C= Time (Military - but can change)
D = Difference
E = ID number

Any help would be appreciated!

1633097282814.png

1633097320947.png
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Column A looks like what you want to use, since you don't have to worry about midnight turnover.
Excel Formula:
=IF(E5=E4,IF(A5-A4<0.25,A5-A4,0),0)

The 0.25 represents 6 hours, so if the gap is more than six hours, it will give a zero.
 
Upvote 0
Column A looks like what you want to use, since you don't have to worry about midnight turnover.
Excel Formula:
=IF(E5=E4,IF(A5-A4<0.25,A5-A4,0),0)

The 0.25 represents 6 hours, so if the gap is more than six hours, it will give a zero.
That worked thank you !!!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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