EXCEL中,用函数筛选不同人名?
发布网友
发布时间:2022-05-02 13:26
我来回答
共4个回答
热心网友
时间:2022-06-20 06:16
如果数据量大,可用如下宏直接提取两列中不重复的姓名到C列
两列中不重复的。用以下宏。
Sub 不重复的()
Dim d, d1, Temp
Dim arr1, arr2
arr1 = Range("A1:A" & Range("A65536").End(xlUp).Row)
arr2 = Range("B1:B" & Range("B65536").End(xlUp).Row)
Set d = CreateObject("Scripting.Dictionary")
Set d1 = CreateObject("Scripting.Dictionary")
For Each Temp In arr2
d1(Temp) = 1
Next
For Each Temp In arr1
If Not d1.exists(Temp) Then d(Temp) = 1
Next
Range("C1").Resize(d.Count) = Application.Transpose(d.keys)
d.RemoveAll
d1.RemoveAll
For Each Temp In arr1
d1(Temp) = 1
Next
For Each Temp In arr2
If Not d1.exists(Temp) Then d(Temp) = 1
Next
Range("C" & Range("C65536").End(xlUp).Row + 1).Resize(d.Count) = Application.Transpose(d.keys)
End Sub
如果只提取A列有B列没有的,可用如下宏
Sub A有B没有的()
Dim d, d1, Temp
Dim arr1, arr2
arr1 = Range("A1:A" & Range("A65536").End(xlUp).Row)
arr2 = Range("B1:B" & Range("B65536").End(xlUp).Row)
Set d = CreateObject("Scripting.Dictionary")
Set d1 = CreateObject("Scripting.Dictionary")
For Each Temp In arr2
d1(Temp) = 1
Next
For Each Temp In arr1
If Not d1.exists(Temp) Then d(Temp) = 1
Next
Range("C1").Resize(d.Count) = Application.Transpose(d.keys)
End Sub
热心网友
时间:2022-06-20 06:17
C1=INDEX(A:A,SMALL(IF(COUNTIF(B:B,A$1:A$10),4^8,ROW($1:$10)),ROW(A1)))&""
数组公式,按Ctrl+Shift+Enter结束公式输入。
向下复制公式。
热心网友
时间:2022-06-20 06:17
人名
热心网友
时间:2022-06-20 06:18
一楼正解