Спасибо, мое решение на PHP:
foreach ($data as $employeeid => $rows) {
sort($rows);
for ($i = 0; $i < count($rows); $i++) {
$tool1Found = $tool2Found = false;
if ($i > 0) {
$previousSetup = $rows[$i - 1];
$previousSetup2 = $rows[$i - 2];
$tool1Found = in_array($rows[$i]['Tool1Identifier'], $previousSetup) || in_array($rows[$i]['Tool1Identifier'], $previousSetup2);
$tool2Found = in_array($rows[$i]['Tool2Identifier'], $previousSetup) || in_array($rows[$i]['Tool2Identifier'], $previousSetup1);
}
echo sprintf('<br />%s <span style="color: %s;">%s</span> <span style="color: %s;">%s</span>', ($i + 1), ($tool1Found ? 'green' : 'red'), $rows[$i]['Tool1Identifier'], ($tool2Found ? 'green' : 'red'), $rows[$i]['Tool2Identifier']);
}
}