Forum

Notifications
Clear all

Find the Total Hours Completed

6 Posts
4 Users
0 Reactions
191 Views
(@rathanak)
Posts: 55
Trusted Member
Topic starter
 

Problem : Find the Total Hours Completed between 5 pm –7am

Let’s say we have this Shift Time Data Row A1,B1,C1,D1

Shift in time 6:00AM  7:00AM  4:00PM

Row A2,B2,C2,D2

Shift out time  4:00PM  5:00PM  10:00PM

i need to calculate the total shift hours that fall between 5 pm to 7 am.

If the shift starts at 7 am and ends at 5 pm. The total hours clocked (between 5 pm and 7 am) will be 0

If the shift starts at 6 am and ends at 4 pm. The total hours clocked (between 5 pm and 7 am) will be 1

If the shift starts at 4 pm and ends at 10 pm. The total hours clocked (between 5 pm and 7 am) will be 5

 
Posted : 10/09/2016 9:24 am
(@sunnykow)
Posts: 1417
Noble Member
 

See if this is what you want

=IF(AND(HOUR(B1)=6,HOUR(B2)=16),1,IF(AND(HOUR(B1)=7,HOUR(B2)=17),0,IF(AND(HOUR(B1)=16,HOUR(B2)=22),5,0)))

 
Posted : 10/09/2016 11:48 am
(@connexionlost)
Posts: 1
New Member
 

How about this:

 

=IF(B1>B2,MIN(24-HOUR(B1),7)+MIN(HOUR(B2),7),MAX(7-HOUR(B1),0)+MAX(HOUR(B2)-17,0))

 

Cheers,

 
Posted : 10/09/2016 3:51 pm
(@sunnykow)
Posts: 1417
Noble Member
 

Another try =IFERROR(INDEX({0,1,5},(MATCH(HOUR(B1),{7,6,16},0)+MATCH(HOUR(B2),{17,16,22},0))/2),0)

Cheers

 
Posted : 10/09/2016 7:37 pm
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi rathanak,

In addition to SunnyKow and ConnexionLosts's answers you can read up on time calculations

Excel Time Calculation Tricks

Calculating Time In Excel

Phil

 
Posted : 10/09/2016 8:45 pm
(@rathanak)
Posts: 55
Trusted Member
Topic starter
 

Thanks all it works fine 

Cheers

 
Posted : 10/09/2016 10:29 pm
Share: