本文目录一览:
Excel中如何用函数实现提取汉字的首字母?
1,复制姓名列,粘贴到word里2,在word里,点击右下角粘贴智能标记,选择“仅保留文本”3,选中word里的姓名文字(一般一次能一次性添加13组拼音,如果要添加拼音的汉字比较多,多选择几次多设置几次),开始-字体-拼音指南,拼音指南里,字号调大一些,确定4,复制添加了拼音的汉字,粘贴到excel里某空列5,用函数PHONETIC取得单元格里的拼音信息字符串,C2=PHONETIC(B2)
excel怎么提取首字母
=LOOKUP(CODE(left(A1)),45217+{0,36,544,1101,1609,1793,2080,2560,2902,3845,4107,4679,5154,5397,5405,5689,6170,6229,7001,7481,7763,8472,9264},{"A","B","C","D","E","F","G","H","J","K","L","M","N","O","P","Q","R","S","T","W","X","Y","Z"})
这个就是提取首字母的公式了!
excel能不能提取文字首字母
方法/步骤
首先,打开Excel,同时按下Alt+F11键,打开VBE界面,如下图所示。在VBE界面中,单击图片中所示的左上角空白处,选择“插入“,”模块“。
此时,就插入了一个模块,后面的代码就要放到这个模块中,保证右侧空白区域是模块代码的编辑区(最保险的做法是双击模块),然后执行下一步操作。
将下面的代码全部复制粘贴到空白区域。
Function pinyin(p As String) As String
i = Asc(p)
Select Case i
Case -20319 To -20284: pinyin = "A"
Case -20283 To -19776: pinyin = "B"
Case -19775 To -19219: pinyin = "C"
Case -19218 To -18711: pinyin = "D"
Case -18710 To -18527: pinyin = "E"
Case -18526 To -18240: pinyin = "F"
Case -18239 To -17923: pinyin = "G"
Case -17922 To -17418: pinyin = "H"
Case -17417 To -16475: pinyin = "J"
Case -16474 To -16213: pinyin = "K"
Case -16212 To -15641: pinyin = "L"
Case -15640 To -15166: pinyin = "M"
Case -15165 To -14923: pinyin = "N"
Case -14922 To -14915: pinyin = "O"
Case -14914 To -14631: pinyin = "P"
Case -14630 To -14150: pinyin = "Q"
Case -14149 To -14091: pinyin = "R"
Case -14090 To -13319: pinyin = "S"
Case -13318 To -12839: pinyin = "T"
Case -12838 To -12557: pinyin = "W"
Case -12556 To -11848: pinyin = "X"
Case -11847 To -11056: pinyin = "Y"
Case -11055 To -2050: pinyin = "Z"
Case Else: pinyin = p
End Select
End Function
Function getpy(str)
For i = 1 To Len(str)
getpy = getpy pinyin(Mid(str, i, 1))
Next i
End Function
然后关闭这个新界面,返回Excel,就可以像Excel自带的函数一样使用这个自定义的Getpy函数了,它只有一个参数,参数可以直接指定单元格,也可以直接输入字符。
需要注意的是,Getpy函数,只返回汉字拼音的首字母,如果是其他的字母或者数据等非汉字文本,会返回原来的值,如下图所示:
好了,关于Excel中如何用函数实现提取汉字的首字母的经验就介绍到这里。如果有什么不明白的地方,可以联系作者。欢迎阅读作者的其他百度经验,提高Excel能力。
EXCEL 如何取汉字首拼(包括多音字首拼)
具体操作步骤如下:
1、首先,打开Excel,然后按Alt+F11快捷键打开Viaual
Basic编辑器,点击工具栏插入-模块,如下图所示,然后进入下一步。
2、其次,把准备好的取拼音首字母大写专函数粘贴进来,关闭Viaual
Basic编辑器,如下图所示,然后进入下一步。
3、接着,回到Excel界面,公示栏输入“=getpy(A1)RIGHT(B1,2)RIGHT(C1,2)”,其中“=getpy(A1)”为求A1单元格的拼音首字母大写,后面是求B1和C1单元格后两位,这时按下回车键执行,如下图所示,然后进入下一步。
4、最后,完成上述步骤后,就得到LDH6582的结果了,如下图所示。这样,问题就解决了。
excel提取首字母
假如人名在A1,那么在B1输入=
LOOKUP(CODE(A1),45217+{0,36,544,1101,1609,1793,2080,2560,2902,3845,4107,4679,5154,5397,5405,5689,6170,6229,7001,7481,7763,8472,9264},{"A","B","C","D","E","F","G","H","J","K","L","M","N","O","P","Q","R","S","T","W","X","Y","Z"})回车就是了