Hi Bryz ,
The correct logic would be as follows :
1. Let us assume that the combination of the Given Names and the Surname will be unique ; this combination can be derived by using C2 & " " & B2.
2. Compare the combination in any row with the combination in the next row ; if this is not the same , then the employee has not been terminated , and is continuing in the same company.
3. If the combination is the same in two successive rows , and the employer is different , then there is a change of company.
If we put all of the above together , our formula would be :
=IF(C2 & " " & B2<> C3 & " " & B3,IF(C2 & " " & B2<> C1 & " " & B1,D2,""),IF(D2 <> D3, D3, ""))
Another possibility would be :
=IF(C2 & " " & B2<> C3 & " " & B3,D2,"")
Narayan