Comparing two columns in Excel with exclusion

后端 未结 2 739
死守一世寂寞
死守一世寂寞 2021-02-04 16:44

I want to compare values in two columns in Excel as depicted in the image below :- \"enter

<
2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-04 17:11

    You can also do this with Advance Filter Assuming Data in Col A and B In Cell C2 write =SUMPRODUCT(--($B$2:$B$17=A2))=0 Select Data A1:A12 Click on Advanced Filter, Choose copy to another location List Range = $A$1:$A$22 Criteria Range = $C$1:$C$2 (Note C1 to be blank) In Copy to Range choose E1, Say OK This will give you Values of A that don't exist in B

    In Cell D2 Write =SUMPRODUCT(--($A$2:$A$22=B2))=0

    Select Data B1:B17 Click on Advanced Filter, Choose copy to another location List Range = $A$1:$A$22 Criteria Range = $D$1:$D$2 (Note D1 to be blank) In Copy to Range choose F1, Say OK This will give you Values of B that dont exist in A

    You can automate this Via a single line of Code

    Sub Get_Data1()

    [List1].AdvancedFilter 2, [Crt1], [Dest1], True

    End Sub

    Sub Get_Data2()

    [List2].AdvancedFilter 2, [Crt2], [Dest2], True

    End Sub

提交回复
热议问题