How to find gap length between date/time?

jm5498

New Member
Joined
May 28, 2022
Messages
1
Office Version
  1. 365
Platform
  1. MacOS
Hello, I have the following spreadsheet:
Screen Shot 2022-05-28 at 2.27.01 PM.png

I'm trying to figure out a formula that finds a gap when no events are valid. So in this case, there are no events valid from 6:00a - 6:03a. I want a way where excel tells me that through a formula in addition to any other gaps that there may be. Thank you!
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
I'm not sure exactly what you mean. Row 3 is in Row 1 is what I think you mean.
 
Upvote 0
I got this
StartEndRow
5/1/2022 5:015/1/2022 5:30FALSE
5/1/2022 5:065/1/2022 5:30TRUE
5/1/2022 6:035/1/2022 6:15FALSE
5/1/2022 6:065/1/2022 6:30FALSE


With this:
VBA Code:
Public Const _
    ColStart = 1, _
    ColEnd = 2, _
    ColTest = 3

Function Time_Test(Calling_Row)
    Sheets("Test").Activate
   
    Time_Test = False
    Start_Date = Cells(Calling_Row, ColStart)
    End_Date = Cells(Calling_Row, ColEnd)
   
    For Row = 11 To 14
        If Calling_Row <> Row Then
            T1 = Start_Date >= Cells(Row, ColStart)
            T2 = (End_Date <= Cells(Row, ColEnd))
            If T1 And T2 Then
                Time_Test = True
                Exit Function
            End If
        End If
    Next Row
   
End Function
How would this be different to be of use?
 
Last edited by a moderator:
Upvote 0

Forum statistics

Threads
1,221,525
Messages
6,160,329
Members
451,637
Latest member
hvp2262

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