源数据------->结果
![](https://img.haomeiwen.com/i4364421/4f46fb10cde56c70.png)
- 提取Group中G开头的‘标签’,并去除重复值。
Sub cdsr()
Dim arr
arr = [a1].CurrentRegion'将数据放到数组
Set d = CreateObject("scripting.dictionary")'创建字典
For i = 2 To UBound(arr)'循环数组元素
s = Split(arr(i, 1), ";")'将数组用split函数分开,s是一维数组
For j = 0 To UBound(s)'遍历数组s每个元素
If s(j) Like "G*" Then'如果是G开头的
d(s(j)) = "" '放进字典(去重复)
End If
Next
Next
[d2].Resize(d.Count, 1) = Application.Transpose(d.keys)'输出数据
End Sub
示例文件下载
链接: http://pan.baidu.com/s/1i5bxCAp 密码: af96
网友评论