Calculating Between Two Times in HH:MM "AM / PM" Format

Justinian

Well-known Member
Joined
Aug 9, 2009
Messages
1,557
Office Version
  1. 365
Platform
  1. Windows
I have a massive list of employees who worked more than ten hours in a single shift.

A2 = John Smith
B2 = 7/15/18
C2 = 11:57 AM
D2 = 4:03 AM

My problem is that we use ADP and in our system, you can clock in 7 minutes before or after the start of your shift and still get credit for starting at that time. For example, if I am supposed to start at 8:00 AM, I can clock in anywhere between 7:53 AM and 8:07 AM to be given credit for starting at 8:00 AM. If I clock in at 7:52 AM, I will get paid starting at 7:45 AM. If I clock in at 8:08 AM, I will get paid starting at 8:15 AM.

What I am trying to do is create a formula that converts the times in C2 and D2 to their proper start times using the following:

1) If someone clocks in 7 minutes before or after the beginning of the hour (e.g., 7:53 AM - 8:07 AM) they get credit for starting at the beginning of the hour
2) If someone clocks in 7 minutes before or after quarter past the hour (e.g., 8:08 AM - 8:22 AM), they get credit for starting at quarter past the hour
3) If someone clocks in 7 minutes before or after the half hour (e.g., 8:23 AM - 8:37 AM) they get credit for starting at the half hour
4) If someone clocks in 7 minutes before or after 3 quarters past the hour (e.g., 8:38 AM - 8:52 AM) they get credit for starting at 3 quarters past the hour

How can I create a formula that converts all times to their proper start and stops predicated on the four rules above?
<strike>
</strike>
 
Last edited:

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Try:
Excel Workbook
CD
311:57 AM12:00 PM
44:03 AM4:00 AM
57:52 AM7:45 AM
67:53 AM8:00 AM
78:07 AM8:00 AM
88:08 AM8:15 AM
98:22 AM8:15 AM
Sheet
 
Upvote 0

Forum statistics

Threads
1,214,956
Messages
6,122,465
Members
449,085
Latest member
ExcelError

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