Excel formula or VBA Identifying gaps in overlapping dates and times

TreeStone

New Member
Joined
Jan 4, 2023
Messages
1
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
I am attempting to find any gaps between a start and stop date/time range. Essentially time when there are no appointments in the schedule, this is a 24hr service and I am looking for "dead" time when there isn't a customer in the office.

Currently I was attempting to use the =SUMPRODUCT((A2<B$2:B$19)*(B2>A$2:A$19))>1 to find overlaps and the issue I am running into is if there are any overlap in start or stop it disqualifies and does not truly identify the space between appointments just if that appointment is double booked at all.

Standby Example.xlsx
ABCDE
1Enc Registration Dt/TmEnc Discharge Dt/TmSUMPRODUCTFormulaGaps in appointments by minute
2Jan 1, 2022, 3:30 AMJan 1, 2022, 4:15 AMFALSESUMPRODUCT((A2<B$2:B$19)*(B2>A$2:A$19))>1-196
3Jan 1, 2022, 7:31 AMJan 1, 2022, 8:35 AMTRUESUMPRODUCT((B3<C$2:C$19)*(C3>B$2:B$19))>1
4Jan 1, 2022, 8:25 AMJan 1, 2022, 10:37 AMTRUESUMPRODUCT((B4<C$2:C$19)*(C4>B$2:B$19))>1
5Jan 1, 2022, 8:30 AMJan 1, 2022, 11:48 AMTRUESUMPRODUCT((B5<C$2:C$19)*(C5>B$2:B$19))>1
6Jan 1, 2022, 8:35 AMJan 1, 2022, 11:40 AMTRUESUMPRODUCT((B6<C$2:C$19)*(C6>B$2:B$19))>1-158
7Jan 1, 2022, 2:17 PMJan 1, 2022, 5:01 PMTRUESUMPRODUCT((B7<C$2:C$19)*(C7>B$2:B$19))>1
8Jan 1, 2022, 2:44 PMJan 1, 2022, 6:04 PMTRUESUMPRODUCT((B8<C$2:C$19)*(C8>B$2:B$19))>1
9Jan 1, 2022, 2:49 PMJan 1, 2022, 5:15 PMTRUESUMPRODUCT((B9<C$2:C$19)*(C9>B$2:B$19))>1
10Jan 1, 2022, 2:54 PMJan 1, 2022, 5:34 PMTRUESUMPRODUCT((B10<C$2:C$19)*(C10>B$2:B$19))>1
11Jan 1, 2022, 5:30 PMJan 1, 2022, 6:43 PMTRUESUMPRODUCT((B11<C$2:C$19)*(C11>B$2:B$19))>1
12Jan 1, 2022, 5:55 PMJan 1, 2022, 9:29 PMTRUESUMPRODUCT((B12<C$2:C$19)*(C12>B$2:B$19))>1
13Jan 1, 2022, 8:53 PMJan 1, 2022, 10:25 PMTRUESUMPRODUCT((B13<C$2:C$19)*(C13>B$2:B$19))>1
14Jan 1, 2022, 9:26 PMJan 2, 2022, 12:29 AMTRUESUMPRODUCT((B14<C$2:C$19)*(C14>B$2:B$19))>1
15Jan 1, 2022, 10:01 PMJan 1, 2022, 11:45 PMTRUESUMPRODUCT((B15<C$2:C$19)*(C15>B$2:B$19))>1
16Jan 1, 2022, 10:50 PMJan 1, 2022, 11:31 PMTRUESUMPRODUCT((B16<C$2:C$19)*(C16>B$2:B$19))>1-7
17Jan 1, 2022, 11:38 PMJan 2, 2022, 1:53 AMTRUESUMPRODUCT((B17<C$2:C$19)*(C17>B$2:B$19))>1
18Jan 1, 2022, 11:42 PMJan 2, 2022, 6:23 AMTRUESUMPRODUCT((B18<C$2:C$19)*(C18>B$2:B$19))>1
19Jan 1, 2022, 11:50 PMJan 2, 2022, 1:56 AMTRUESUMPRODUCT((B19<C$2:C$19)*(C19>B$2:B$19))>1
Sheet1
Cell Formulas
RangeFormula
E2,E16,E6E2=(B2-A3)*1440
C2:C19C2=SUMPRODUCT((A2<B$2:B$19)*(B2>A$2:A$19))>1
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,215,537
Messages
6,125,390
Members
449,222
Latest member
taner zz

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