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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
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,223,901
Messages
6,175,277
Members
452,629
Latest member
SahilPolekar

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