本帖最后由 咔咔乱坠 于 2024-7-12 11:49 编辑
excel,好像是海鲜老师的
- =CONCAT(IFNA(BASE(MATCH(MID(A2,SEQUENCE(LEN(A2)),1),MID("吖八擦咑鵽发伽哈丌丌咔垃妈拿哦妑七然仨他屲屲屲夕丫帀",ROW($1:$26),1))+9,36),""))
复制代码 wps,改海鲜老师
- =CONCAT(IFNA(VLOOKUP(MID(A2,SEQUENCE(LEN(A2)),1),{"吖","A";"八","B";"擦","C";"咑","D";"鵽","E";"发","F";"伽","G";"哈","H";"丌","I";"丌","J";"咔","K";"垃","L";"妈","M";"拿","N";"哦","O";"妑","P";"七","Q";"然","R";"仨","S";"他","T";"屲","U";"屲","V";"屲","W";"夕","X";"丫","Y";"帀","Z"},2),""))
复制代码 vba自定义函数,忘了哪位朋友的了
- '批量提取首字母
- Function 首字母$(ByVal rng$)
- Dim i%, 首字母Arr, str$, ch$
- 首字母Arr = [{"吖","A";"八","B";"攃","C";"咑","D";"妸","E";"发","F";"旮","G";"哈","H";"丌","J";"咔","K";"垃","L";"妈","M";"乸","N";"噢","O";"帊","P";"七","Q";"冄","R";"仨","S";"他","T";"屲","W";"夕","X";"丫","Y";"帀","Z"}]
- str = Replace(Replace(rng, " ", ""), " ", "") '去空格和Tab
- For i = 1 To Len(str)
- ch = Mid(str, i, 1)
- If ch Like "[一-龥]" Then '如果是汉字,进行转换
- 首字母 = 首字母 & WorksheetFunction.Lookup(Mid(str, i, 1), 首字母Arr)
- Else
- '首字母 = 首字母 & UCase(ch) '如果不是汉字,直接输出
- End If
- Next
- End Function
复制代码
|