# Calculating hours/minutes between time ranges

Status
Not open for further replies.

#### excelforeverything

##### New Member
Hello all,

I'm in dire need of finding a better solution to this problem:

I am in need of caclulating the time between multiple time ranges. Time Range A is a recurring schedule for the month of November, that allocates specific time slots to users, who are then allowed to login during these specific times slots. If the user happens to login outside of these time slots, goes over their allotted time slot or logins in before their allotted times slots then I need to calculate the hours/minutes that they are logged in anywhere outside of their assigned time slot. I am given a large log of the date and duration that users have logged in, which we will call Time Range B.

***Happy to upload excel file if necessary.

Example of Time Range A/Recurring Schedule:

 User Name Start time End time User 1 20:54 23:59 User 1 0:00 6:45 User 1​ 9:32 11:45 User 1​ 19:38 21:35 User 2 6:25 10:00

<colgroup><col><col><col></colgroup><tbody>
</tbody>

Example of Time Range B/User Log of Date/Duration:
 User Name Start Time Start Date End Time End Date Duration User 1 19:55:14 11/02/18 20:57:02 11/02/18 01:01:48 User 1​ 8:41:40 11/03/18 11:56:10 11/03/18 03:14:30 User 1​ 11:44:16 11/04/18 11:52:24 11/04/18 00:08:08 User 1​ 11:57:18 11/04/18 12:50:40 11/04/18 00:53:22 User 1​ 11:07:00 11/05/18 12:06:02 11/05/18 00:59:02

<colgroup><col><col><col><col><col><col></colgroup><tbody>
</tbody>
<strike></strike>
 User 2​ 17:55:37 11/20/18 18:05:17 11/20/18 00:09:40 User 2​ 11:50:54 11/21/18 13:36:32 11/21/18 01:45:38 User 2​ 14:42:20 11/21/18 16:02:36 11/21/18 01:20:16 User 2​ 5:34:22 11/23/18 6:49:00 11/23/18 01:14:38 User 2​ 6:17:01 11/23/18 6:47:14 11/23/18 00:30:13 User 2​ 5:52:44 11/24/18 7:25:38 11/24/18 01:32:54

<colgroup><col><col><col><col><col><col></colgroup><tbody>
</tbody>
<strike></strike>

<colgroup><col><col><col><col><col><col></colgroup><tbody>
</tbody>
<strike></strike>
<strike></strike><strike></strike><strike></strike>

<colgroup><col><col><col><col><col><col></colgroup><tbody>
</tbody>

<colgroup><col><col><col><col><col><col></colgroup><tbody>
</tbody>
<strike>
</strike>

### Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

#### Fluff

##### MrExcel MVP, Moderator
Duplicate https://www.mrexcel.com/forum/excel...s-time-ranges-do-not-overlap.html#post5190485

Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread.
Per forum rules, posts of a duplicate nature will be locked or deleted (rule 12 here: Forum Rules).

Note that sometimes posts from new users require Moderator approval before you can see them on the public forums. When this happens, you should see a message to that effect when you try to post it.
Please be patient and do not attempt to post the question again.

Status
Not open for further replies.

Replies
1
Views
59
Replies
3
Views
85
Replies
4
Views
208
Replies
4
Views
180
Replies
1
Views
162

1,127,685
Messages
5,626,293
Members
416,172
Latest member
lordposh

### 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.

### Which adblocker are you using?

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

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