excel怎样将汉字转换为拼音首字母

 时间:2024-10-28 23:31:35

怎样将汉字转换为拼音首字母?本文给出详细教程

工具/原料

office办公软件

Excel2007

方法/步骤

1、以Excel2007为例:打开相应的Excel文件,按“Alt+F11”组合召堡厥熠键,弹出“VisualBasic编辑器”如下图:

excel怎样将汉字转换为拼音首字母

2、鼠标点击“VisualBasic编辑器”菜单栏的“插入”选项,选择下拉列表里的“模块”,插入“模块”,如下图:

excel怎样将汉字转换为拼音首字母

excel怎样将汉字转换为拼音首字母

3、将下面的代码复制粘贴到里面:Functiongetpychar(char)咯悝滩镞tmp=65536+Asc(char)If(tmp>=45婷钠痢灵217Andtmp<=45252)Thengetpychar="A"ElseIf(tmp>=45253Andtmp<=45760)Thengetpychar="B"ElseIf(tmp>=45761Andtmp<=46317)Thengetpychar="C"ElseIf(tmp>=46318Andtmp<=46825)Thengetpychar="D"ElseIf(tmp>=46826Andtmp<=47009)Thengetpychar="E"ElseIf(tmp>=47010Andtmp<=47296)Thengetpychar="F"ElseIf(tmp>=47297Andtmp<=47613)Thengetpychar="G"ElseIf(tmp>=47614Andtmp<=48118)Thengetpychar="H"ElseIf(tmp>=48119Andtmp<=49061)Thengetpychar="J"ElseIf(tmp>=49062Andtmp<=49323)Thengetpychar="K"ElseIf(tmp>=49324Andtmp<=49895)Thengetpychar="L"ElseIf(tmp>=49896Andtmp<=50370)Thengetpychar="M"ElseIf(tmp>=50371Andtmp<=50613)Thengetpychar="N"ElseIf(tmp>=50614Andtmp<=50621)Thengetpychar="O"ElseIf(tmp>=50622Andtmp<=50905)Thengetpychar="P"ElseIf(tmp>=50906Andtmp<=51386)Thengetpychar="Q"ElseIf(tmp>=51387Andtmp<=51445)Thengetpychar="R"ElseIf(tmp>=51446Andtmp<=52217)Thengetpychar="S"ElseIf(tmp>=52218Andtmp<=52697)Thengetpychar="T"ElseIf(tmp>=52698Andtmp<=52979)Thengetpychar="W"ElseIf(tmp>=52980Andtmp<=53640)Thengetpychar="X"ElseIf(tmp>=53679Andtmp<=54480)Thengetpychar="Y"ElseIf(tmp>=54481Andtmp<=62289)Thengetpychar="Z"Else'如果不是中文,则不处理getpychar=charEndIfEndFunction'逐个取ASC码Functiongetpy(str)Fori=1ToLen(str)getpy=getpy&getpychar(Mid(str,i,1))NextiEndFunction

4、然后关闭VisualBasic编辑窗口,返回Excel编辑状态。分别如下图:

excel怎样将汉字转换为拼音首字母

5、选中B2单元格,输入公式"=getpy(a1)",鼠标移到B2单元格右下角,下拉填充公式即可,如下图:

excel怎样将汉字转换为拼音首字母

excel怎样将汉字转换为拼音首字母

在EXCEL中如何取汉字拼音首字母? excel将选区内数据实现汉字转拼音首字母 Excel中如何用函数实现提取汉字的首字母 excel如何利用公式实现提取拼音首字母
热门搜索
短发蛋卷头发型图片 动漫巨乳 凡人修仙传动漫 动漫衣服 火烧圆明园图片