Time in each hourly interval

phiero21

Board Regular
Joined
Sep 20, 2007
Messages
136
I have a start time and end time in Col A & Vol B. Then i have 24 hourly intervals in next 24 columns. What I need is the time spent in each hourly interval

e.g.
Start Time: 3:20 am
End time: 5:10 pm


Interval:
00:00 to 01:00 00
01:00 to 02:00 00
02:00 to 03:00 00
03:00 to 04:00 40
04:00 to 05:00 60
05:00 to 06:00 10

06:00 to 07:00 00
07:00 to 08:00 00
 

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.
Hi,

take a look at this:


Excel 2016 (Windows) 64 bit
ABCDEFGHIJKLMNOPQRSTUVWXYZAA
1time intime out00:0001:0002:0003:0004:0005:0006:0007:0008:0009:0010:0011:0012:0013:0014:0015:0016:0017:0018:0019:0020:0021:0022:0023:0000:00
203:2017:1000:0000:0000:0000:4001:0001:0001:0001:0001:0001:0001:0001:0001:0001:0001:0001:0001:0000:1000:0000:0000:0000:0000:0000:0000:00
Sheet2
Cell Formulas
RangeFormula
C2=IF(MEDIAN(HOUR($A2),HOUR($B2),HOUR(C$1))=HOUR(C$1),IF(C$1+TIME(1,0,0)<$B2,C$1+TIME(1,0,0)-MAX(C$1,$A2),IF(HOUR($T1)=HOUR($B2),MAX(C$1,$B2)-C$1,0)),0)
 
Last edited:
Upvote 0
Hi,

take a look at this:


Excel 2016 (Windows) 64 bit
ABCDEFGHIJKLMNOPQRSTUVWXYZAA
1time intime out00:0001:0002:0003:0004:0005:0006:0007:0008:0009:0010:0011:0012:0013:0014:0015:0016:0017:0018:0019:0020:0021:0022:0023:0000:00
203:2017:1000:0000:0000:0000:4001:0001:0001:0001:0001:0001:0001:0001:0001:0001:0001:0001:0001:0000:1000:0000:0000:0000:0000:0000:0000:00
Sheet2
Cell Formulas
RangeFormula
C2=IF(MEDIAN(HOUR($A2),HOUR($B2),HOUR(C$1))=HOUR(C$1),IF(C$1+TIME(1,0,0)<$B2,C$1+TIME(1,0,0)-MAX(C$1,$A2),IF(HOUR($T1)=HOUR($B2),MAX(C$1,$B2)-C$1,0)),0)


Thanks so much for your time. It is calculating the initial intervals correctly, but not the last one. (E.g. if teh start time is 3:20 and End time is 3:30, it will show incorrectly).
 
Upvote 0
try this:


Excel 2016 (Windows) 64 bit
ABCDEFGHI
1time intime out00:0001:0002:0003:0004:0005:0006:00
203:2003:4500:0000:0000:0000:2500:0000:0000:00
Sheet1
Cell Formulas
RangeFormula
C2=IF((MEDIAN(HOUR($A2),HOUR($B2),HOUR(C$1))=HOUR(C$1)),MIN(C$1+TIME(1,0,0),$B2)-MAX($A2,C$1),0)
 
Upvote 0
try this:


Excel 2016 (Windows) 64 bit
ABCDEFGHI
1time intime out00:0001:0002:0003:0004:0005:0006:00
203:2003:4500:0000:0000:0000:2500:0000:0000:00
Sheet1
Cell Formulas
RangeFormula
C2=IF((MEDIAN(HOUR($A2),HOUR($B2),HOUR(C$1))=HOUR(C$1)),MIN(C$1+TIME(1,0,0),$B2)-MAX($A2,C$1),0)

Thanks, it works
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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