If numbers in both list are required.
[TABLE="width: 256"]
<colgroup><col width="64" span="4" style="width:48pt"> </colgroup><tbody>[TR]
[TD="class: xl65, width: 64"]A[/TD]
[TD="class: xl65, width: 64"]B[/TD]
[TD="class: xl65, width: 64"]C[/TD]
[TD="class: xl65, width: 64"]D[/TD]
[/TR]
[TR]
[TD="class: xl66, align: right"]32[/TD]
[TD="class: xl66, align: right"]11[/TD]
[TD="class: xl66"] [/TD]
[TD="class: xl66, align: right"]11[/TD]
[/TR]
[TR]
[TD="class: xl66, align: right"]45[/TD]
[TD="class: xl66, align: right"]12[/TD]
[TD="class: xl66"] [/TD]
[TD="class: xl66, align: right"]34[/TD]
[/TR]
[TR]
[TD="class: xl66, align: right"]12[/TD]
[TD="class: xl66, align: right"]34[/TD]
[TD="class: xl66"] [/TD]
[TD="class: xl66, align: right"]51[/TD]
[/TR]
[TR]
[TD="class: xl66"] [/TD]
[TD="class: xl66, align: right"]51[/TD]
[TD="class: xl66"] [/TD]
[TD="class: xl66, align: right"]45[/TD]
[/TR]
[TR]
[TD="class: xl66"] [/TD]
[TD="class: xl66, align: right"]51[/TD]
[TD="class: xl66"] [/TD]
[TD="class: xl66"] [/TD]
[/TR]
[TR]
[TD="class: xl66"] [/TD]
[TD="class: xl66, align: right"]32[/TD]
[TD="class: xl66"] [/TD]
[TD="class: xl66"]
[/TD]
[/TR]
</tbody>[/TABLE]
ARRAY formula in D2
Code:
=IFERROR(INDEX($B:$B,SMALL(IF((COUNTIF($D$1:$D1,$B$2:$B$7)=0)*(COUNTIF($A$2:$A$4,$B$2:$B$7)=0),ROW($B$2:$B$7),""),1)),IFERROR(INDEX($A:$A,SMALL(IF((COUNTIF($D$1:$D1,$A$2:$A$4)=0)*(COUNTIF($B$2:$B$7,$A$2:$A$4)=0),ROW($A$2:$A$4),""),1)),""))