非重复值复制粘贴

我有成千上万的logging,我想在Excel中只find非重复值。 从列AI我想过去列C中的值不等于B.有人可以帮助我一样。

A | B | C -------|-------|------- 1 | 4 | 1 2 | 5 | 2 3 | 6 | 3 4 | 7 | 13 5 | 8 | 14 6 | 9 | 15 7 | 10 | 8 | 11 | 9 | 12 | 10 | 16 | 11 | 17 | 12 | | 13 | | 14 | | 15 | | 16 | | 17 | | 

我已经尝试了粘贴我的值在C中,并把这个公式在B列以及..但这不是一些细胞后工作。

 =IF(ISERROR(MATCH(A1,$C$1:$C$10000,0)),"",A1) 

针对您的问题使用助手列说明了Column E (根据需要更改列E)。

Cell E2写下面的公式:

 =IFERROR(INDEX($A$2:$A$20, MATCH(0,INDEX(COUNTIF(E1:$E$1, $A$2:$A$20)+(COUNTIF($A$2:$A$20, $A$2:$A$20)<>1),0,0), 0)),"") 

然后根据需要拖放/复制此公式。 这将给你从Column A非重复的数字。

然后在Cell C2input下面的公式:

 =IFERROR(INDEX($E$2:$E$20,MATCH(0,IFERROR(MATCH($E$2:$E$20,$B$2:$B$12,0),COUNTIF($C$1:$C1,$E$2:$E$20)),0)),"") 

这是一个数组公式,通过按下Ctrl + Shift + Enter来提交它,并根据需要拖放/复制这个公式,你将得到你想要的结果,如下图所示:

在这里输入图像说明

编辑: VBA解决scheme________________________________________________________________________________

 Sub Demo() Dim dict1 As Object, dict2 As Object, dict3 As Object Dim c1 As Variant, c2 As Variant Dim i As Long, lastRow As Long Set dict1 = CreateObject("Scripting.Dictionary") Set dict2 = CreateObject("Scripting.Dictionary") Set dict3 = CreateObject("Scripting.Dictionary") lastRow = Cells(Rows.count, "A").End(xlUp).Row '-->get last row of Column A c1 = Range("A2:A" & lastRow) 'add unique values in Column A to dict1 For i = 1 To UBound(c1, 1) dict1(c1(i, 1)) = 1 Next i lastRow = Cells(Rows.count, "B").End(xlUp).Row '-->get last row of Column B c2 = Range("B2:B" & lastRow) 'add unique values in Column B to dict2 For i = 1 To UBound(c2, 1) dict2(c2(i, 1)) = 1 Next i 'check existence of dict1 values in dict2 'if not present add to dict3 For Each k In dict1.keys If Not dict2.exists(k) Then dict3.Add k, 1 End If Next k 'display dict3 in Column C Range("C2").Resize(dict3.count) = Application.Transpose(dict3.keys) End Sub