Using your original sample file wherein we assume sorting data is not permitted (else we would sort by date etc) then:
D2:
=REPT("P",(MAX(IF($A$2:$A$42=$A2,$C$2:$C$42))=$C2)*OR($B2="CONP",ISNA(MATCH($A2&"@CONP@"&$C2,$A$2:$A$42&"@"&$B$2:$B$42&"@"&$C$2:$C$42,0))))
confirmed with CTRL + SHIFT + ENTER (enter alone will not suffice)
copied down
it's not clear what should happen in scenarios where multiple MAX dates are located for a given contact but none of those dates has COMP action - ie which is then to be selected ?
the above is merely an alternative... a little long winded I grant you !
Bookmarks