I am a novice Powershell user and would like help with the following:
I am comparing the values in one one array with that of another. If they match, I write the value to a cell, if there is no match, the cell is highlighted red. However, with only two small arrays (each ~200 values) the search takes hours. There must be better way, please help.
$ArrFinal = $arrA + $arrB + $arrC + $arrD
$ArrFinal = $ArrFinal | select -uniq | sort-object
for ($k=1; $k -lt $ArrFinal.length; $k++)
{
for ($j=1; $j -lt $arrA.length; $j++)
{
if($ArrFinal[$k] -like $arrA[$j])
{
$cells.item($k+1,2)=$arrA[$j]
$cells.item($k+1,2).Interior.ColorIndex = 2
break
}
else
{
$cells.item($k+1,2).Interior.ColorIndex = 3
}
}
}