excel提取首字母?一、首先打开Excel,然后按Alt+F11打开Viaual Basic编辑器,点击栏“插入”,下拉菜单内点击“模块”。二、把准备好的取拼音首字母大写函数粘贴进来,关闭Viaual Basic编辑器。三、回到Excel界面,那么,excel提取首字母?一起来了解一下吧。
可以早扰利用LEFT函数实现。
假设表格如下,需要提取A列单元格拼音的首字圆塌母填写在相应B列单元格中。
步骤:在B1单元橘睁圆格输入公式“=LEFT(A1,1)”,回车,然后向下填充即可。
最终效果:
1,复制姓名列,粘贴到word里
2,在word里,点击右下角粘贴智能标记,选择“仅保留文本”
3,选中word里的姓名文字(一般一次能一次性添加孝握13组拼音,如果要添加拼音的汉字比较多,多选择几次多设置几次),开始-字体-拼音指南,拼音指南罩慎培里,字号调大一些,确定
4,复制添加了拼音的汉字,粘贴到excel里某空列
5,用函数PHONETIC取得单元物唯格里的拼音信息字符串,C2=PHONETIC(B2)
可以网上搜一下啊,很多的
Excel汉字转换得到其拼音函数
2008年12月10日 星期三 09:21
打开Excel->->宏->Viaual Basic编辑器
在弹出来的窗口中对着VBAproject点右键->插入->模块
下面会出现一个名为"模块1",点击
在右边的空白栏中粘贴以下内容:
''''''''''''''''''物脊''''
'VBscript代码提供者:小白
'联系方法:
'E-mail:xiaobai@17560.net
'
'VBA代码转换者:惟惟
'联系方法:Email:wuweiyin@yeah.net
'个人博客:http://weiwei.blog.163.com
'如有不正确的地方,请提出来或是帮忙完善
'谢谢
'罩陪渗'''''''''''''''''''''''''''''
Function getpychar(char)
tmp = 65536 + Asc(char)
If (tmp >= 45217 And tmp <= 45252) Then
getpychar = "A"
ElseIf (tmp >= 45253 And tmp <= 45760) Then
getpychar = "B"
ElseIf (tmp >= 45761 And tmp <= 46317) Then
getpychar = "C"
ElseIf (tmp >= 46318 And tmp <= 46825) Then
getpychar = "D"
ElseIf (tmp >= 46826 And tmp <= 47009) Then
getpychar = "E"
ElseIf (tmp >= 47010 And tmp <乱仔= 47296) Then
getpychar = "F"
ElseIf (tmp >= 47297 And tmp <= 47613) Then
getpychar = "G"
ElseIf (tmp >= 47614 And tmp <= 48118) Then
getpychar = "H"
ElseIf (tmp >= 48119 And tmp <= 49061) Then
getpychar = "J"
ElseIf (tmp >= 49062 And tmp <= 49323) Then
getpychar = "K"
ElseIf (tmp >= 49324 And tmp <= 49895) Then
getpychar = "L"
ElseIf (tmp >= 49896 And tmp <= 50370) Then
getpychar = "M"
ElseIf (tmp >= 50371 And tmp <= 50613) Then
getpychar = "N"
ElseIf (tmp >= 50614 And tmp <= 50621) Then
getpychar = "O"
ElseIf (tmp >= 50622 And tmp <= 50905) Then
getpychar = "P"
ElseIf (tmp >= 50906 And tmp <= 51386) Then
getpychar = "Q"
ElseIf (tmp >= 51387 And tmp <= 51445) Then
getpychar = "R"
ElseIf (tmp >= 51446 And tmp <= 52217) Then
getpychar = "S"
ElseIf (tmp >= 52218 And tmp <= 52697) Then
getpychar = "T"
ElseIf (tmp >= 52698 And tmp <= 52979) Then
getpychar = "W"
ElseIf (tmp >= 52980 And tmp <= 53640) Then
getpychar = "X"
ElseIf (tmp >= 53689 And tmp <= 54480) Then
getpychar = "Y"
ElseIf (tmp >= 54481 And tmp <= 62289) Then
getpychar = "Z"
Else '如果不是中文,则不处理
getpychar = char
End If
End Function
Function getpy(str)
For i = 1 To Len(str)
getpy = getpy & getpychar(Mid(str, i, 1))
Next i
End Function
********复制到此结束,本行不复制*******
现在转换函数已编写完成!关掉此编缉的窗口。
在网上转换,这铅拆嫌有网槐手址看以试一下:御前http://www.aies.cn/pinyin.htm
分两步
1、取得拼音
得用到VBA
打开Excel->->宏->Viaual Basic编辑器
在弹出来的窗口中对着VBAproject点右键->插入->模块
下面会出现一个名为"模块1",点击
在衫唯右边的空白栏早塌明中粘贴以下内容:
''''''''''''''''''''''''''''''
Function getpychar(char)
tmp = 65536 + Asc(char)
If (tmp >= 45217 And tmp <= 45252) Then
getpychar = "A"
ElseIf (tmp >= 45253 And tmp <= 45760) Then
getpychar = "B"
ElseIf (tmp >= 45761 And tmp <= 46317) Then
getpychar = "C"
ElseIf (tmp >= 46318 And tmp <= 46825) Then
getpychar = "D"
ElseIf (tmp >= 46826 And tmp <= 47009) Then
getpychar = "E"
ElseIf (tmp >= 47010 And tmp <= 47296) Then
getpychar = "F"
ElseIf (tmp >= 47297 And tmp <= 47613) Then
getpychar = "G"
ElseIf (tmp >= 47614 And tmp <= 48118) Then
getpychar = "H"
ElseIf (tmp >= 48119 And tmp <= 49061) Then
getpychar = "J"
ElseIf (tmp >= 49062 And tmp <= 49323) Then
getpychar = "K"
ElseIf (tmp >= 49324 And tmp <= 49895) Then
getpychar = "L"
ElseIf (tmp >= 49896 And tmp <= 50370) Then
getpychar = "M"
ElseIf (tmp >= 50371 And tmp <= 50613) Then
getpychar = "N"
ElseIf (tmp >= 50614 And tmp <= 50621) Then
getpychar = "O"
ElseIf (tmp >= 50622 And tmp <= 50905) Then
getpychar = "P"
ElseIf (tmp >= 50906 And tmp <= 51386) Then
getpychar = "Q"
ElseIf (tmp >= 51387 And tmp <= 51445) Then
getpychar = "R"
ElseIf (tmp >= 51446 And tmp <= 52217) Then
getpychar = "S"
ElseIf (tmp >= 52218 And tmp <= 52697) Then
getpychar = "T"
ElseIf (tmp >= 52698 And tmp <= 52979) Then
getpychar = "W"
ElseIf (tmp >= 52980 And tmp <= 53640) Then
getpychar = "X"
ElseIf (tmp >= 53689 And tmp <= 54480) Then
getpychar = "Y"
ElseIf (tmp >= 54481 And tmp <= 62289) Then
getpychar = "Z"
Else '如果不是中文,则不处理
getpychar = char
End If
End Function
Function getpy(str)
For i = 1 To Len(str)
getpy = getpy & getpychar(Mid(str, i, 1))
Next i
End Function
按ALT+F11回到EXCEL
2、如果你的表陆告如下
A B C D
1姓名 出生年月 工作时间
2刘德华 19651982
在D2单元格输入公式
=getpy(A2)&right(B2,2)&right(C2,2)
OK了
以上就是excel提取首字母的全部内容,2、将生成的拼音粘贴回excel,利用分列功能分成3列,每列都选文本格式;3、按第三列(该列两字人名为空)排序,将空格排到下方;4、在其后第一列第一行、第二行手动输入第一个、第二个人名首字母,选中两单元格。