HOUR Function

Relevant answer

Mayukh Bhattacharya 1 year ago

Tom Wells you could try this way, since I am not sure how the hours are shown in your data, I have assumed its in the format mm/dd/yyyy 0000hrs

• Formula used in cell D2

=IF(INT(LEFT(C2,FIND(" ",C2)-1)+0-LEFT(B2,FIND(" ",B2)-1)+0)+MOD(TEXT(SUBSTITUTE(RIGHT(C2,7),"hrs",""),"00:00")+0-TEXT(SUBSTITUTE(RIGHT(B2,7),"hrs",""),"00:00")+0,1)*24<4,"Pass","Fail")

2 Likes

Relevant answer

Erik Guzik 1 year ago

The solution given above is a very good one. If you need to populate it down for more rows Starting in Row 2 Cells A B for you listed times... use this (adjust cell references for your sheet, none given so just guessing) =time(RANDBETWEEN(hour(A2),Hour(B2)),RANDBETWEEN(0,59),0)

This also assumes Whole hours in the given times. if you start at 14:25 --> 16:15 then some alterations on the minutes will need to be done to make that work, would be quite a bit more depending on actual values.

0 Likes

Hot network questions