|
楼主 |
发表于 2019-11-4 07:27
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
试试
Function qc(Rng, Optional x = 0) '单元格内或者区域去重
'第二参数省略为去重计数;不等于0时提取不重复字符!
Dim i As Long, dic
arr = Rng
Set dic = CreateObject("scripting.dictionary")
For j = 1 To UBound(arr)
For i = 1 To Len(arr(j, 1))
If Not dic.Exists(Mid(arr(j, 1), i, 1)) Then
dic(Mid(arr(j, 1), i, 1)) = ""
End If
Next
Next
qc = Join(dic.keys, "")
If x = 0 Then qc = Len(qc)
End Function
Function qqc(Rng, Optional x = 0) '单元格内或者区域去重
'x=1 区域去重排序、x=0 区域去重计数
'除汉字、全角字符、特殊字符以外的所有字符串
Dim i As Long, arr(255)
brr = Rng
On Error Resume Next '
For j = 1 To UBound(brr)
For i = 1 To Len(brr(j, 1))
arr(Asc(Mid(brr(j, 1), i, 1))) = Mid(brr(j, 1), i, 1)
Next
Next
qqc = Join(arr, "")
If x = 0 Then qqc = Len(qqc)
End Function
|
评分
-
4
查看全部评分
-
|