How to take a date and time and split the minutes between the two across the hours

derek12345

New Member
Joined
Nov 2, 2018
Messages
2
OK the title is a tad long, here is what I need:

Say you have a login time and a logout time, this will give you a specific duration in hours and minutes. I would like to spread the minutes across the hours for the day in question:

Example:

Login Time Logout Time Total Duration
02/02/2014 11:55 02/02/2014 18:32 6:37:03

8-9am 9-10am 10-11am 11-12pm 12-1pm 1-2pm 2-3pm 3-4pm 4-5pm 5-6pm 6-7pm ETC
0 0 0 5 60 60 60 60 60 60 32


Is this even possible? I have checked every formula and decided VBA was the only way, but have little to no experience.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Assume your headings are in row 1, Logon col A, Log Out B (only use the time not date), Duration C, only put start time in d through to r (or wherever) as 08:00 , 09:00 , 10:00 etc.

then try this formula in D, and copy across to column before the last date:

=IF($A2>E1,0,IF($A2>D1,60-VALUE(MINUTE($A2)),60))-IF($B2<=D1,60,IF($B2>=E1,0,60-VALUE(MINUTE($B2))))
 
Upvote 0
Assume your headings are in row 1, Logon col A, Log Out B (only use the time not date), Duration C, only put start time in d through to r (or wherever) as 08:00 , 09:00 , 10:00 etc.

then try this formula in D, and copy across to column before the last date:

=IF($A2>E1,0,IF($A2>D1,60-VALUE(MINUTE($A2)),60))-IF($B2<=D1,60,IF($B2>=E1,0,60-VALUE(MINUTE($B2))))

Worked like a charm! Thanks for that!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
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