Forum Discussion

Rwogan's avatar
Rwogan
Copper Contributor
Jul 19, 2022

How can I count overall staffing time per hour per day?

So, i have my staff log in and log out time, but i need to show it as total mins worked per hour block.

The problem I am encountering is if someone finishes mid hour as i will get the value incorrect!!!  

This is the formula i am using at present for the cell highlighted in red (CELL O8) - but it should read 42 mins, only 11

 

Thoughts?

 

=IF(AND($H8<P$2,$H8<O$2),"",IF(IF($H8<P$2,SUM($H8-$F8),IF($F8>O$3," ",SUM(O$3-$F8)-SUM($M8:N8)))<0," ",IF($H8<P$2,$H8-O$2,IF($F8>O$3," ",SUM(O$3-$F8)-SUM($M8:N8)))))

 

 

LoginDateLogoutDateDuration   01:00:00             
     08:00:0009:00:0010:00:0011:00:0012:00:0013:00:0014:00:0015:00:0016:00:0017:00:0018:00:0019:00:0020:00:0021:00:0022:00:0023:00:00 
     09:00:0010:00:0011:00:0012:00:0013:00:0014:00:0015:00:0016:00:0017:00:0018:00:0019:00:0020:00:0021:00:0022:00:0023:00:00  
01/07/202212:15:1401/07/202215:10:282:55:14    00:44:4601:00:0001:00:0000:10:28         
01/07/202215:16:2701/07/202221:21:586:05:31       00:43:3301:00:0001:00:0001:00:0001:00:0001:00:0000:21:58   
03/07/202210:00:2303/07/202217:10:487:10:25  00:59:3701:00:0001:00:0001:00:0001:00:0001:00:0001:00:0000:10:48       
03/07/202217:17:5803/07/202219:00:271:42:29         00:42:0201:00:0000:00:27     
05/07/202210:30:5605/07/202210:42:0811:12  00:42:08              
05/07/202210:42:1105/07/202210:42:550:44                 
05/07/202210:46:5205/07/202220:20:099:33:17                 
05/07/202220:31:3305/07/202221:02:2530:52                 
06/07/202212:15:2206/07/202221:15:058:59:43                 
07/07/202212:15:2507/07/202216:52:304:37:05                 
07/07/202216:52:5607/07/202217:31:5338:57                 
08/07/202212:15:5308/07/202221:16:129:00:19                 
10/07/202210:00:0710/07/202216:02:406:02:33                 
11/07/202213:00:3811/07/202220:11:067:10:28                 
13/07/202212:15:1213/07/202221:44:359:29:23                 
14/07/202212:15:2514/07/202221:15:128:59:47                 
  • tauqeeracma's avatar
    tauqeeracma
    Steel Contributor

    Hi Rwogan 

     

    You can achieve your desired results by using the below formula.

    =IF(AND(MATCH($B4,$F$2:$U$2,1)=MATCH($D4,$F$2:$U$2,1),MATCH($D4,$F$2:$U$2,1)=F$1),($D4-$B4),IF(MATCH($B4,$F$2:$U$2,1)=F$1,(F$3-$B4),IF(MATCH($D4,$F$2:$U$2,1)=F$1,($D4-F$2),IF(AND(MATCH($B4,$F$2:$U$2,1)<=F$1,MATCH($D4,$F$2:$U$2,1)>=F$1),TIME(1,0,0),""))))

    Please refer to the attached sample file wherein I have updated this formula for your reference.

     

    I have observed some inconsistency in column E (duration). For instance, in row 11, the actual duration should be 30 minutes and 52 seconds, but it appears as 30 hours and 52 minutes. Anyhow, I have also put a formula for this column.

     

    I hope it will be helpful.

     

    Please let me know if it works for you.

     

    Thanks

    Tauqeer

Resources