One possible approach if we assume values start in A1 & B1
First
D1: =SUMPRODUCT(--ISNA(MATCH(A1:A5,B1:B5,0)))
gives count of missing numbers
Then
C1:
=IF(ROWS(C$1:C1)>$D$1,"",SMALL(IF(ISNA(MATCH($A$1:$A$5,$B$1:$B$5,0)),$A$1:$A$5),ROWS(C$1:C1)))
confirmed with CTRL + SHIFT + ENTER
copied down
An alternative approach (not requiring CTRL + SHIFT + ENTER (though not more efficient per se)) if you were to insert a row above the first values such that what was row 1 becomes row 2 and row 1 is thus blank...
D2:
=SUMPRODUCT(--ISNA(MATCH($A$2:$A$6,$B$2:$B$6,0)))
(as before but different range obviously)
C2:
=IF(ROWS(C$2:C2)>$D$2,"",INDEX($A$2:$A$6,MATCH(1,INDEX((ISNA(MATCH($A$2:$A$6,$B$2:$B$6,0))*ISNA(MATCH($A$2:$A$6,$C$1:$C1,0))),0),0)))
copied down
There are various other routes open to you - some simpler than the above if you can use "helper" cells, not clear.
Let us know.
Bookmarks