hi Lifeseeker. your sample should include 3 scenarios:
1) Same ID, same Intake, different admission
2) Same ID, different Intake, same admission
3) Same ID, different Intake, different admission
and tell us which should be kept or deleted by manually typing in column E. i saw only 1 eg of (2) & the rest are (3). but since your formula in column E is not working like you expect, i'm not sure what should the answers be. this formula here will:
1) keep 1st entry of (1), delete the rest
2) keep last entry of (2), delete the rest
3) delete all of (3)
Formula:
=IF(OR(AND(COUNTIFS($A$2:$A$174,A2,$B$2:$B$174,B2)>1,MATCH(A2&B2,INDEX($A$1:$A$174&$B$1:$B$174,),0)=ROW()),AND(COUNTIFS($A$2:$A$174,A2,$C$2:$C$174,C2)>1,LOOKUP(2,1/(($A$2:$A$174=A2)*($C$2:$C$174=C2)),ROW($A$2:$A$174))=ROW())),"keep","Delete")
this will keep all of (3):
Formula:
=IF(OR(AND(COUNTIFS($A$2:$A$174,A2,$B$2:$B$174,B2)>1,MATCH(A2&B2,INDEX($A$1:$A$174&$B$1:$B$174,),0)=ROW()),AND(COUNTIFS($A$2:$A$174,A2,$C$2:$C$174,C2)>1,LOOKUP(2,1/(($A$2:$A$174=A2)*($C$2:$C$174=C2)),ROW($A$2:$A$174))=ROW()),COUNTIFS($A$2:$A$174,A2,$B$2:$B$174,B2)+COUNTIFS($A$2:$A$174,A2,$C$2:$C$174,C2)=2),"keep","Delete")
Bookmarks