我有成千上万的记录,我想在Excel中只找到非重复的值。从列A开始,我想通过C列中不等于B的值。有人可以帮助我。
UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscape
我已经尝试过在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 | |
答案 0 :(得分:0)
使用辅助列说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 C2
中输入以下公式:
=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解决方案 的 ------------------------------------------------------------------------ 强>
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