How to calculate what hour a time stamped event happened between a start and end time.

jtedmonson42

New Member
Joined
Jan 22, 2017
Messages
23
What would be the best way to figure up which hour a timestamp event occured between two times stamps? Say a clock punch for example.
Data set up similar to below. How would I get the 2 in the hour occured?

PunchTimeShiftStartTimeShiftEndTimeHour Occurred
10:0008:3018:302
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Try:

Book4 (version 1).xlsb
ABCD
1PunchTimeShiftStartTimeShiftEndTimeHour Occurred
210:008:3018:302
Sheet6
Cell Formulas
RangeFormula
D2D2=ROUNDUP((A2-B2)*24,0)
 
Upvote 0
Apologies I was mistaken on the set up on the data. I forgot about the date being included in the event timestamp, which I need because I'm looking at multiple days. I have a set up like below with a column to pull the event hour using the =hour(a2) formula because I was previously sorting events based on the hour they occurred, but I'm wanting to add the ability to sort by the hour it occurred on each person's shift.

EventTimeEventHour(using the hour() formulat)ShiftStartShiftEndHourOccurred
8/21/21 22:302218:304:30
 
Upvote 0
Ideally, if you're going to work with times that could span multiple days, you should have the date included in the time in both places, both the EventTIme and the ShiftStart. But as long as a shift doesn't last over 24 hours, this should work:

Book4 (version 1).xlsb
ABCDE
1EventTimeEventHour(using the hour() formulat)ShiftStartShiftEndHourOccurred
28/21/2021 22:302218:304:304
Sheet6
Cell Formulas
RangeFormula
E2E2=ROUNDUP(((MOD(A2,1)-C2)+(C2>MOD(A2,1)))*24,0)


Note that I did not use the B2 cell, since in so doing we lose the :30 which might be important.
 
Upvote 0
Solution

Forum statistics

Threads
1,215,660
Messages
6,126,089
Members
449,288
Latest member
DjentChicken

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