excel表格怎么把汉字转换成拼音简码

 我来答
晕惨敝1
2019-04-12 · TA获得超过166个赞
知道小有建树答主
回答量:182
采纳率:100%
帮助的人:67.9万
展开全部

Excel中可以利用自定义函数来实现将汉字转换成拼音。

所用工具:Office2007

举例说明如下:

1.将A列数据转换成拼音:

2.alt+F11插入模块,在模块中输入如下代码,代码很多(由于篇幅限制,无法将全部代码发上来,可以搜索汉字ASC码来获取),但原理很简单,利用每个汉字的ASC码来得到这个汉字的拼音,然后依次提取单元格中的每一个汉字,分别获得其拼音。

Function pinyin(p As String) As String

i = Asc(p)

Select Case i

Case -20319 To -20318: pinyin = "a "

Case -20317 To -20305: pinyin = "ai "

Case -20304 To -20296: pinyin = "an "

Case -20295 To -20293: pinyin = "ang "

Case -20292 To -20284: pinyin = "ao "

Case -20283 To -20266: pinyin = "ba "

Case -20265 To -20258: pinyin = "bai "

Case -20257 To -20243: pinyin = "ban "

Case -20242 To -20231: pinyin = "bang "

Case -20230 To -20052: pinyin = "bao "

Case -20051 To -20037: pinyin = "bei "

Case -20036 To -20033: pinyin = "ben "

Case -20032 To -20027: pinyin = "beng "

Case -20026 To -20003: pinyin = "bi "

Case -20002 To -19991: pinyin = "bian "

Case -19990 To -19987: pinyin = "biao "

Case -19986 To -19983: pinyin = "bie "

……

Case -11055 To -11053: pinyin = "za "

Case -11052 To -11046: pinyin = "zai "

Case -11045 To -11042: pinyin = "zan "

Case -11041 To -11039: pinyin = "zang "

Case -11038 To -11025: pinyin = "zao "

Case -11024 To -11021: pinyin = "ze "

Case -11020 To -11020: pinyin = "zei "

Case -11019 To -11019: pinyin = "zen "

Case -11018 To -11015: pinyin = "zeng "

Case -11014 To -10839: pinyin = "zha "

Case -10838 To -10833: pinyin = "zhai "

Case -10832 To -10816: pinyin = "zhan "

Case -10815 To -10801: pinyin = "zhang "

Case -10800 To -10791: pinyin = "zhao "

Case -10790 To -10781: pinyin = "zhe "

Case -10780 To -10765: pinyin = "zhen "

Case -10764 To -10588: pinyin = "zheng "

Case -10587 To -10545: pinyin = "zhi "

Case -10544 To -10534: pinyin = "zhong "

Case -10533 To -10520: pinyin = "zhou "

Case -10519 To -10332: pinyin = "zhu "

Case -10331 To -10330: pinyin = "zhua "

Case -10329 To -10329: pinyin = "zhuai "

Case -10328 To -10323: pinyin = "zhuan "

Case -10322 To -10316: pinyin = "zhuang "

Case -10315 To -10310: pinyin = "zhui "

Case -10309 To -10308: pinyin = "zhun "

Case -10307 To -10297: pinyin = "zhuo "

Case -10296 To -10282: pinyin = "zi "

Case -10281 To -10275: pinyin = "zong "

Case -10274 To -10271: pinyin = "zou "

Case -10270 To -10263: pinyin = "zu "

Case -10262 To -10261: pinyin = "zuan "

Case -10260 To -10257: pinyin = "zui "

Case -10256 To -10255: pinyin = "zun "

Case -10254 To -10254: pinyin = "zuo "

Case Else: pinyin = p

End Select

End Function

Function py(str)

For i = 1 To Len(str)

py = py & pinyin(Mid(str, i, 1))

Next i

End Function


3.这样,返回Excel利用自定义的py函数即可:

4.下拉填充,就可以得到全部汉字的拼音:

已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式