Function to identify overlapping records.

bfuchs
bfuchs used Ask the Experts™
on
Hi Experts,
I am looking for a function that will read a csv file containing employees schedule date & time and identify all the overlapping records.
Below is an example of what the file looks like and what would be considered an overlapping schedule.
UnitCostCenter,EmployeeCode,EmployeeName,StartDate,StartTime,EndTime,Lunch,TotalHours,OnCallFlag,CallBackFlag,ChargeFlag
,A1236       ,J A               ,4/26/2019,3:00:00 AM,11:00:00 AM,1,7,,,
,A1236       ,J A               ,4/25/2019,3:00:00 PM,7:00:00 AM,2,14,,,

"It's because those two TS in the spreadsheet for 4/25/ and 4/26 are overlapped (just put them in correct order - TS 4/25 ends next day at 7AM ):"
Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
can you post the file ?

and what you mean by

"It's because those two TS in the spreadsheet for 4/25/ and 4/26 are overlapped (just put them in correct order - TS 4/25 ends next day at 7AM ):"

Please give us what you expect the macro or function to do with a clear example.
Gowflow
Hi,

Here is a link to the file.
and what you mean by

"It's because those...
This is an explanation why those two records are overlapping each other.

Really my goal is to have the function edit that file and change the 2nd record's start time from AM to PM.

However to keep it simple its enough if function would just return all the overlapping schedules (only the 2nd record which overlaps the first, in the example above, the record from date 4/26/19).

Thanks,
Ben
Ben Personick (Previously QCubed)Lead SaaS Infrastructure Engineer

Commented:
1) If you are putting this into excel in the first place, why not:

1 Sort on the Date Column to put them in the correct order  (You didn't directly ask for this but then at the bottom of your Q it looks like someone asked you for this)
2.  We could easily add conditional Formatting to highlight overlapping cells whether contiguous or not.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Ben Personick (Previously QCubed)Lead SaaS Infrastructure Engineer

Commented:
If your goal is to edit the CSV because you need it for, say, an external system, you shouldn't use Excel at all, and instead write a script to run on a given file and amend it as you need, Powershell seems the obvious choice in that scenario.
1) I looked at your file and some time values have AM PM some have not. Should we concider that the data is correct ?? like 3:00 is 3:00 AM ?
2) What do these are supposed to be AM to PM or AM to AM …?
4/21/2019      3:00      11:00
4/22/2019      3:00      11:00
4/23/2019      3:00      11:00
3) You say

Really my goal is to have the function edit that file and change the 2nd record's start time from AM to PM.

Then if I have to assume that you are talking about this

,A1236       ,J A               ,4/26/2019,3:00:00 AM,11:00:00 AM,1,7,,,
,A1236       ,J A               ,4/25/2019,3:00:00 PM,7:00:00 AM,2,14,,,

Then you expect it to be:

,A1236       ,J A               ,4/26/2019,3:00:00 PM,11:00:00 AM,1,7,,,
,A1236       ,J A               ,4/25/2019,3:00:00 PM,7:00:00 AM,2,14,,,

Is that on 26/3 to have 3:00 PM instead of 3:00 AM ?

if yes then you need to get your data to all have AM and PM as otherwise we cannot guess.
Gowflow
@Ben Personick,

This file comes from one system and we need to import into another system.
However I would prefer to have this script written in either VB or VBA as this is the language I'm familiar with.

@Gowflow,
Your assumptions about the output are correct.
Regarding your question on data, guess when there are no AM PM specified then those records can be ignored.

FYI- Here is a thread dealing with similar script for the same file in question.
Also after we run that script, most of the records (if not ALL) should by then contain AM/PM.

Thanks,
Ben
pls highlight In  yellow the problem in this file and choose a column where you put what to expect as not clear at all for me.
gowflow
Book1.csv
Mark EdwardsChief Technology Officer

Commented:
This is a good example of why you would want to use Access to do stuff like this.  Very easy in Access to analyze csv file data - piece 'o cake even!

Since you didn't say anything about using Access or even Excel- only "analyzing a .csv file" and a reference to "VBA" and "scripting language", I can only assume you want to try and do this with a script.....

HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA!!!!!!!!!

Seriously, though, do you only want just a VB script that does this?  What would be your preferred solution?
Mark EdwardsChief Technology Officer

Commented:
One tip here is to break the start and end times into startdate/starttime, and enddate/endtime.  Some of your endtimes are in the next day.  This way, all you have to do is compare the enddate/endtime with a startdate/starttime for the same UnitCostCenter and EmployeeCode.  Check to see if a enddate/endtime is later than the startdate/starttime for the same day.   easy to do in Access, but a waste of time in script......
Ben Personick (Previously QCubed)Lead SaaS Infrastructure Engineer

Commented:
He just wants a VB Script yes, no need for Excel, I would prefer to do it Powershell since it's simple to work with CSVs in Powershell, but the OP prefers VBs so have at it.
@gowflow,
See attached a problem (the original file may not have an instance of this problem, therefore I edited and highlighted per your request).
About location where to put the expected, it does not matter you can either change the original file or follow the path of Bill (at the other post) and create a new file containing the new data.
Thanks,
Ben
Untitled.png
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA!!!!!!!!!
Oh! to my luck, the expert who is willing to do in VB Script is having a difficult time to understand my problem, and those who seem to understand my problem are only ready to do it in other platforms..:)

Thanks,
Ben
Ben Personick (Previously QCubed)Lead SaaS Infrastructure Engineer

Commented:
XD
ok I saw your snapshot then what u want is
1/3/2019 12:00:00 AM 8:30:00 PM

Right ?
If the answer is yes I will build the VBA to read a .txt file is that file ?
Gowflow
Mark EdwardsChief Technology Officer

Commented:
Ben:  Sorry, but this old developer just couldn't help but smile a little when he read that someone wanted to do a job meant for a database app with VBScript, which is used to automate webpages and do light-weight scripting processing, not data manipulation and analysis.
If you ever do get a solution in VB Script, feel free to rub it in real good.  I'd like to see such a solution.

By the way, this thread has "VBA" as a classification keyword.  Where does "VBA" come into this in your view?  I could whip up an Access VBA app in about 15-20 minutes if you're open to an Access solution, or you can wait for a VBScript solution.... Your call.
Ben Personick (Previously QCubed)Lead SaaS Infrastructure Engineer

Commented:
@Mark it's actually a formatting and record change problem, of output from system A needing to be Fed ito System B from what I read but I am not OP.

It's totally a scripting problem IMO.  But I think he chose the VBA tag because he thought he needed to load the file into excel in order to manipulate it since he wasn't aware you could do so directly .
@gowflow,
No, the record of 1/3/19 should remain intact, as it is the first record.
The next one of 1/4/19 should be
,a,b,1/4/2019,7:30:00 PM,8:00:00 AM,1,7.5,,,
instead of
,a,b,1/4/2019,7:30:00 AM,8:00:00 AM,1,7.5,,,
Thanks,
Ben
@Mark,

Perhaps you right about identify the records, however since as mentioned my goal is to either create a new file or edit the existing one, which that will require some of coding that reads a CSV file line by line and does the job, I assume there is no difference in using a script or Access VBA.

As a matter of fact, I mainly use Access for my apps, and when it comes to debugging VB scripts I import them in Access and do my work over there, its just easier to deploy VB script which is a simple executable file.

Besides since we already have a script that would need to run every time before loading this file to system B, I thought of adding this to that script.

Thanks,
Ben
Hi Experts,

Any hope here...why is everyone chickening out...?

Thanks,
Ben
Mark EdwardsChief Technology Officer

Commented:
Hey Ben:  I got a little bored, so I took your sample file and made a quick-and-dirty analysis with Access:

1st, a lot of your TotalHours are miscalculated by 1 hour.

2nd, I've attached an Excel spreadsheet to show the results of what I found overlapping after filtering out the times with no AM/PM and those records whose start and stop times are on the same day and don't overlap.

I've gone thru all my VBScript books and how-to articles, even some google searches, and I can't find ANY mention of anyone using VBScript for data manipulation and analysis - not even an example.  The only tools available for loading table data is arrays and ADO recordsets - both very hard to do any comparison analysis with, even if you knew how.  It would take someone several days of research and trial-and-error testing to put something like that together.  I'm sure someone would be willing to try for the right price..... you willing to make it worth someone's while?

Let me know if you are interested in playing with my Access solution.  I've only got the linked .csv file and queries working, but with a little time, it would be easy to add an automation that would link, analyze and spit-out a new file if I only knew what you wanted to do with all the junk and how you wanted to fix any overlap (what causes the overlap in the first place?  What makes the data  wrong?)
OverlappingTimePeriods_Result.xlsx
Mark EdwardsChief Technology Officer

Commented:
Ben:  Just read your link - that explains the TotalHours mismatch, so forget I said anything.

Also, how do you tell what to assign AM or PM.  8 AM to 5 PM is 9 hours, and 8 PM to 5 AM is 8 hours - which is it?
Hi Mark,

Well if nobody here will come up with a VB Script solution I will definitely consider using an Access solution, as long as it does what I'm looking for.
(And this is why I included VBA under the topics).
Also, how do you tell what to assign AM or PM.  8 AM to 5 PM is 9 hours, and 8 PM to 5 AM is 8 hours - which is it?
In that case its not really a difference, as long as it matches total hours and does not cause overlapping issues with other records...
(what causes the overlap in the first place?  What makes the data  wrong?)
Can't answer you but must be human error.

BTW, When you have time, take a look at this too, so you get a complete idea on the script we are running for this file before submitting it to system B.

My plan is to run this Script/Access VBA Function after that script took place.

Thanks,
Ben
@bfuch
I still hv a question and that is what is delaying the production of the code the lack of understanding the pattern not ‘chickenning out’

You said
The next one of 1/4/19 should be
,a,b,1/4/2019,7:30:00 PM,8:00:00 AM,1,7.5,,,
But if we look at this record fm 7:30am to 8:00pm you have 11:5 hours where here you have 1+7.5

How can we rely one time on total hours to see if time is correct and the other time the total hours or time stamped does’nt match the hours.

I appreciate your clarification
Gowflow
@gowflow,
Good catch!
It happened to be on this example you're talking that I did it manually w/o taking the total hours into account.
But perhaps when programming, if by changing the start time from AM to PM will cause the total hours to be incorrect (up to two hours is fine if they are off, as explained on other link above), then these records should be ignored.
Thanks,
Ben
Just to clarify,
The example file only contains one employee, but in reality there could be many employees, so we have to take into account when programming, to consider it as overlapping only if both are of same employee.
Thanks,
Ben
Well you post part of data then you give explanations by bits and each time we discover something new. All this contribute to delays both for u and the Experts.

Do we have a way to know if the data is for a specific employee?

Can you post FULL DATA that have more then 1 employee??

Macroes are produced based on logic if Expert does not know or detect the logic one cannot produce any viable working final solution.

I usually hardly fail in producing something correct and to the point only after i gather ALL the info there is.
Gowflow
Ben Personick (Previously QCubed)Lead SaaS Infrastructure Engineer

Commented:
@Ben

  It was quite late for me I am juat waking.

  I would be fine writing a powershell to handle so long as we have the clear requirements on how to handle the incorrect values, Powershell lets you natively work on CSV and I have a nice base script I recently made from which I can work on.

However, I got the impression you wanted vbscript and that @Glowflow was already working on that for you, so I decided to try to facilitate the question by helping answer other experts Qs about it to help you along instead.

I hope that has been helpful
@Ben
We all agree we need to have the complete requirements that what I emphasized on my posts already. There is no competition even if one is working on VBA, VBScript or else you are always welcome to put your solution and asker will have all the choices there is. This is the essence of EE.
Gowflow
Ben Personick (Previously QCubed)Lead SaaS Infrastructure Engineer

Commented:
@Glowflow,

@Ben
We all agree we need to have the complete requirements that what I emphasized on my posts already.

Not sure if this is @ me or at OP, Its a little confusing since we are both Bens.

I wish we could really tag others.


In any case, yes, you and I have both been asking Author for the info, and I think we have been doing a good job at supporting each other.  I hope you agree :)


There is no competition even if one is working on VBA, VBScript or else

True, but I decided to just go for "team player" here and help as rhe OP said I understand the Q but want to do it in a language OP specifically said they would prefer not to use.

Writing the VBScript from scratch, would take me far longer than reusing ths PSCode I already have and I figured you already started why duplicate work?

  I enjoy helping and want to see people get the best solution, so sometimes I just try and facilitate when I think another capable expert, such as yourself, has it handled.

This is also something that has become more rewarding under the new points system as well, since we can all mark comments as helpful and OP often gives out more helpful comment bonuses too.  :)
Most Valuable Expert 2018
Distinguished Expert 2018
Commented:
Finding an overlap is trivial - you just need to check whether the previous end date is later than the next start date for the same user.
The real problem is the format of the time cells, because honestly, it's just a hot mess. This is something you have to fix at an organizational level, it's nothing that can be automated with a script.
You have identical start and end times (but TotalHours > 0), you have times without am/pm indicator, you have times where StartTime has am/pm, but EndTime doesn't.
You have StartTimes at about any time of day, and TotalHours of up to 18 hours, so there's no way to reliably fix the missing am/pm indicator automatically.
Because of that, the following script does not try to fix anything - it checks the time format and overlap, and adds some columns with proper date/time, and the results of the check (OK, ERROR, OVERLAP).
This is PowerShell, because, let's face it, VBScript is dead, and rightfully so. PS is so much more powerful and easier, it's not even funny anymore. You will not get around it if you're working in IT, so the faster you get used to it, the better.
Save as Test-Overlap.ps1 or Whatever.ps1.
By default, the results will be sent to stdout, so you can assign them to a variable, or pipe them to Out-GridView for a quick analysis in PS, or filter them further, whatever PowerShell allows you to do.
It will try to open "book1.csv" in the working folder by default. Use the -Path argument (or change the default value in the script) to process a different file.
You can optionally pass the "-OutFile <Csv file>" argument, and it will write the results as csv to that file instead of sending them to stdout.
Open a PS console, run it, for example, like this:
Test-Overlap.ps1 -Path C:\Temp\book1.csv
## or
Test-Overlap.ps1 -Path C:\Temp\book1.csv -OutFile C:\Temp\results.csv
## or
Test-Overlap.ps1 -Path C:\Temp\book2.csv | Out-GridView

Open in new window

If PS complains that the script isn't signed, run the following and then try again:
Set-ExecutionPolicy RemoteSigned -Force

Open in new window


Param(
	[string]$Path = '.\book1.csv',
	[string]$OutFile
)

Function Test-Date($StartDate, $StartTime, $EndTime, $TotalHours) {
	$tolerance = [timespan]::FromHours(2)
	$enUs = New-Object -TypeName System.Globalization.CultureInfo -ArgumentList 'en-US'
	$out = '' | Select-Object -Property DTStartTime, DTEndTime, @{n='Result'; e={'OK'}}, Details
	Try {$out.DTStartTime = [DateTime]::ParseExact("$($StartDate) $($StartTime)", 'M/d/yyyy h:mm tt', $enUs)} Catch {}
	Try {$out.DTEndTime = [DateTime]::ParseExact("$($StartDate) $($EndTime)", 'M/d/yyyy h:mm tt', $enUs)} Catch {}
	If ($out.DTStartTime -and $out.DTEndTime) {
		If ($out.DTStartTime -eq $out.DTEndTime) {
			$out.Details = 'StartTime and EndTime are identical.'
		} Else {
			If ($out.DTStartTime -gt $out.DTEndTime) {$out.DTEndTime = $out.DTEndTime.AddDays(1)}
			$diffStartEndTotal = $out.DTEndTime - $out.DTStartTime - [timespan]::FromHours($TotalHours)
			If ($diffStartEndTotal -lt 0) {
				$out.Details = 'TotalHours longer than start/end difference.'
			} ElseIf ($diffStartEndTotal -gt $tolerance) {
				$out.Details = "Difference between start/end and TotalHours greater than tolerance ($($tolerance.TotalHours)h)."
			}
		}
	} Else {
		$out.Details = 'Time format incorrect.'
	}
	If ($out.Details) {$out.Result = 'ERROR'}
	$out
}

$rows = Import-Csv -Path $Path | ForEach-Object {
	$test = Test-Date -StartDate $_.StartDate -StartTime $_.StartTime -EndTime $_.EndTime -TotalHours $_.TotalHours
	Select-Object -InputObject $_ -Property *, @{n='DTStartTime'; e={$test.DTStartTime}}, @{n='DTEndTime'; e={$test.DTEndTime}}, @{n='Result'; e={$test.Result}}, @{n='Details'; e={$test.Details}}
}
$rows | Where-Object {$_.Result -eq 'OK'} | Group-Object -Property EmployeeCode | ForEach-Object {
	$buffer = $null
	$_.Group | Sort-Object -Property DTStartTime | ForEach-Object {
		If ($buffer -and ($buffer.DTEndTime -gt $_.DTStartTime)) {
			$buffer.Result = 'OVERLAP'
			$buffer.Details = ($buffer.Details, "Overlaps with next ($($_.DTStartTime) --> $($_.DTEndTime))." | Where-Object {$_}) -join ' '
			$_.Result = 'OVERLAP'
			$_.Details = ($_.Details, "Overlaps with previous ($($buffer.DTStartTime) --> $($buffer.DTEndTime))." | Where-Object {$_}) -join ' '
		}
		$buffer = $_
	}
}
If ($OutFile) {
	$rows | Export-Csv -NoTypeInformation -Path $OutFile
} Else {
	$rows
}

Open in new window

@Gowflow,
Sorry,
I thought had mentioned that employees column included in OP was part of the logic info.
As Mark correctly outlined above.
This way, all you have to do is compare the enddate/endtime with a startdate/starttime for the same UnitCostCenter and EmployeeCode.
However I'm attaching a small file with some of the employees column filled in, hope that fulfills the requirement.

@Ben Personick,
Since I'm having a hard time explaining the requirements...you are very w/c of helping out here.

@Ben, @oBdA,
I have nothing against Powershell scripting language, its just that I'm simply not familiar with it and would not be able to support in the future, other than rely on your EE guys to do the job for me...

Thanks,
Ben
Book3.csv
Ok will do as soon as am back to my pc if no one beats me to it. Off to a movie :)
One last thing the file we are treating is what extension? .txt or .csv?
And what is the output file you want to have .txt or .csv

If i have the choice i would prefer .csv cos manipulation vba wyes easier
Gowflow
Most Valuable Expert 2018
Distinguished Expert 2018

Commented:
Well, you're currently relying on us anyway :)
Did you give it a shot?
Trust me, PS is a lot easier to learn and to handle than VBScript, since you can test every command interactively, live, and in color in the console. The web is full of how-tos, guides, examples.
Since you're familiar with VBScript, I bet you can read the script and tell roughly what it does.
The Out-GridView example from above will give you an output like this, which you can filter easily, like for "Overlap":
Test-Overlap_GridViewYou can easily see that an attempt at "fixing" these by swapping AM to PM or vice versa will usually just get you an invalid time. The first overlap, fixed like this, would turn into 22 hours.
@oBdA,
Excuse me for asking such simple questions...how do copy/paste things on the PS console?
The first time I right clicked it went thru, however I cant seem to do it again.
Thanks,
Ben
Most Valuable Expert 2018
Distinguished Expert 2018

Commented:
Depends on the Windows version, and whether the Quick Edit mode is enabled in the properties of the console; the newer consoles allow Ctrl-C and Ctrl-V as well.
What should always work is to right-click the title bar and select Edit > Paste
@oBdA,
That does not work, see attached.
BTW, when fixing it, perhaps you can have the results option just have the same columns as original file, with fixed data (as the system B expects a file of certain format).
You have identical start and end times (but TotalHours > 0), you have times without am/pm indicator, you have times where StartTime has am/pm, but EndTime doesn't.
As mentioned, all these do not need to be fixed, can remain as is.

@gowflow,
File is CSV and expected results should also be the same.

Thanks,
Ben
Untitled.png
Most Valuable Expert 2018
Distinguished Expert 2018

Commented:
What exactly "does not work"? There is no overlap.
And what do you mean with "fixed data"? As I described above, I don't see a way to automatically "fix" any of these dates and retain meaningful/correct data.
What is "system B" doing with this information when not even the actual event time can be determined because the am/pm indicator is missing?
Hi,
What exactly "does not work"? There is no overlap.
Actually you right, didn't realize the start time of 1/3 was AM...excuse me for that.
Now regarding fixing the data, as mentioned already, if one of the overlapping records has no AM/PM on it then you can ignore them (don't fix any),
The purpose of this is to have the all the records imported into SystemB, which will not accept overlapping records, however if systemB accepts them, then we don't care about the timing being correct (most important are the total hours here).
Thanks,
Ben
Thanks to ALL participants!!
Ben Personick (Previously QCubed)Lead SaaS Infrastructure Engineer

Commented:
You're welcome!  Glad to help!  :)
@oBdA,
Why am I getting for all records an error results?
See attached.
Thanks,
Ben
Untitled.png
1.csv
Most Valuable Expert 2018
Distinguished Expert 2018
Commented:
Because now, in addition to "h:mm" and "h:mm tt", you also have "h:mm:ss tt" as DateTime format.
Well, in for a penny, in for a pound:
Param(
	[string]$Path = '.\book1.csv',
	[string]$OutFile
)

Function Test-Date($StartDate, $StartTime, $EndTime, $TotalHours) {
	$tolerance = [timespan]::FromHours(2)
	$enUs = New-Object -TypeName System.Globalization.CultureInfo -ArgumentList 'en-US'
	$out = '' | Select-Object -Property DTStartTime, DTEndTime, @{n='Result'; e={'OK'}}, Details
	Try {
		$out.DTStartTime = [DateTime]::ParseExact("$($StartDate) $($StartTime)", 'M/d/yyyy h:mm tt', $enUs)
	} Catch {
		Try {$out.DTStartTime = [DateTime]::ParseExact("$($StartDate) $($StartTime)", 'M/d/yyyy h:mm:ss tt', $enUs)} Catch {}
	}
	Try {
		$out.DTEndTime = [DateTime]::ParseExact("$($StartDate) $($EndTime)", 'M/d/yyyy h:mm tt', $enUs)
	} Catch {
		Try {$out.DTEndTime = [DateTime]::ParseExact("$($StartDate) $($EndTime)", 'M/d/yyyy h:mm:ss tt', $enUs)} Catch {}
	}
	If ($out.DTStartTime -and $out.DTEndTime) {
		If ($out.DTStartTime -eq $out.DTEndTime) {
			$out.Details = 'StartTime and EndTime are identical.'
		} Else {
			If ($out.DTStartTime -gt $out.DTEndTime) {$out.DTEndTime = $out.DTEndTime.AddDays(1)}
			$diffStartEndTotal = $out.DTEndTime - $out.DTStartTime - [timespan]::FromHours($TotalHours)
			If ($diffStartEndTotal -lt 0) {
				$out.Details = 'TotalHours longer than start/end difference.'
			} ElseIf ($diffStartEndTotal -gt $tolerance) {
				$out.Details = "Difference between start/end and TotalHours greater than tolerance ($($tolerance.TotalHours)h)."
			}
		}
	} Else {
		$out.Details = 'Time format incorrect.'
	}
	If ($out.Details) {$out.Result = 'ERROR'}
	$out
}

$rows = Import-Csv -Path $Path | ForEach-Object {
	$test = Test-Date -StartDate $_.StartDate -StartTime $_.StartTime -EndTime $_.EndTime -TotalHours $_.TotalHours
	Select-Object -InputObject $_ -Property *, @{n='DTStartTime'; e={$test.DTStartTime}}, @{n='DTEndTime'; e={$test.DTEndTime}}, @{n='Result'; e={$test.Result}}, @{n='Details'; e={$test.Details}}
}
$rows | Where-Object {$_.Result -eq 'OK'} | Group-Object -Property EmployeeCode | ForEach-Object {
	$buffer = $null
	$_.Group | Sort-Object -Property DTStartTime | ForEach-Object {
		If ($buffer -and ($buffer.DTEndTime -gt $_.DTStartTime)) {
			$buffer.Result = 'OVERLAP'
			$buffer.Details = ($buffer.Details, "Overlaps with next ($($_.DTStartTime) --> $($_.DTEndTime))." | Where-Object {$_}) -join ' '
			$_.Result = 'OVERLAP'
			$_.Details = ($_.Details, "Overlaps with previous ($($buffer.DTStartTime) --> $($buffer.DTEndTime))." | Where-Object {$_}) -join ' '
		}
		$buffer = $_
	}
}
If ($OutFile) {
	$rows | Export-Csv -NoTypeInformation -Path $OutFile
} Else {
	$rows
}

Open in new window

Thank you!
Hi Experts,

You were successful in providing the script above, perhaps you can help with this one, similar case...

Thanks,
Ben

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial