'A列为源数据,A1开始
Option Explicit
Sub test()
Dim arr, dic(1 To 3), i
For i = 1 To UBound(dic): Set dic(i) = CreateObject("scripting.dictionary"): Next
arr = Split("00、01、08", "、"): setdic arr, dic(1)
arr = Split("036、058、136、258、397、445、865、982", "、"): setdic arr, dic(2)
arr = Range("a1:a" & [a65536].End(xlUp).Row)
For i = 1 To UBound(arr, 1)
If Not dic(1).exists(Left(arr(i, 1), 2)) And Not dic(2).exists(Left(arr(i, 1), 3)) Then If Not dic(3).exists(arr(i, 1)) Then dic(3).Add arr(i, 1), 1
Next
[b:b].ClearContents
If dic(3).Count > 0 Then [b1].Resize(dic(3).Count, 1) = WorksheetFunction.Transpose(dic(3).keys)
End Sub
Function setdic(arr, dic)
Dim i
For i = 0 To UBound(arr): dic.Add arr(i), 1: Next
End Function
Option Explicit
Sub test()
Dim arr, dic(1 To 3), i
For i = 1 To UBound(dic): Set dic(i) = CreateObject("scripting.dictionary"): Next
arr = Split("00、01、08", "、"): setdic arr, dic(1)
arr = Split("036、058、136、258、397、445、865、982", "、"): setdic arr, dic(2)
arr = Range("a1:a" & [a65536].End(xlUp).Row)
For i = 1 To UBound(arr, 1)
If Not dic(1).exists(Left(arr(i, 1), 2)) And Not dic(2).exists(Left(arr(i, 1), 3)) Then If Not dic(3).exists(arr(i, 1)) Then dic(3).Add arr(i, 1), 1
Next
[b:b].ClearContents
If dic(3).Count > 0 Then [b1].Resize(dic(3).Count, 1) = WorksheetFunction.Transpose(dic(3).keys)
End Sub
Function setdic(arr, dic)
Dim i
For i = 0 To UBound(arr): dic.Add arr(i), 1: Next
End Function