首页 / 教程
获取wps中汉字首字母 | wps表格获取字词对应的第一个字母
2022-12-27 00:28:00
1.wps表格如何获取字词对应的第一个字母
预览该模板: 在日常工作过程中,我们常需要获取汉字对应的第一个字母,比如,学生用音序查字法查字词典,医院建立药品查询系统,KTV建立歌曲查询系统……有没有办法轻松获取字词的第一个字母呢?大家都知道ET和EXCLE可以按音序排列中文数据,这就表明电子表格已经能洞悉汉字拼音的第一个字母与其在汉字编码系统的位置的关系了。
只要查询出汉字在编码系统中的位置,并告知相同音序的汉字在编码中的起始位置,电子表格就可以将汉字的音序轻松获取。想三秒钟获取汉字对应的第一个字母就打开你的WPS表格2012,跟我试试吧!一、打开原始工作簿,在准备填充字母的列粘贴下列嵌套公式: =LOOKUP(CODE(A2),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"}) 在这个公式中,CODE函数旨在查询词语(字符串)第一个字符对应的数字代码,这些代码其实标明了这个汉字在代码库中的具体排位,LOOKP函数就根据不同音序汉字在代码库中的起始位置,获取到这个汉字的第一个字母了。
其中,A2是引用汉语字词所在的单元格名称,大家可获取字词前两个汉字所对应的第一个字母根据实际情况修改。二、如果你想获取词语第二个汉字对应的字母,可以将上述公式中的A2改为MID(A2,2,1),表示从字符串的第二个开始取的第一个,即第二个。
具体公式为:=LOOKUP(CODE(MID(A2,2,1)),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"}) 如果想取第三个可以以此类推,即: =LOOKUP(CODE(MID(A2,3,1)),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"}) 三、如果想获取前两个汉字音序怎么办?用“&”将获取第一、二个汉字音序的公式合并即可。如果想获取前三个汉字音序就用“&”将获取第一、二、三个汉字音序的公式合并。
获取字符串前三个汉字音序的公式: =LOOKUP(CODE(A2),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"})&LOOKUP(CODE(MID(A2,2,1)),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"})&LOOKUP(CODE(MID(A2,3,1)),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"})。
2.WPS表格如何获取字词对应的第一个字母
一、打开原始工作簿,在准备填充字母的列粘贴下列嵌套公式:=LOOKUP(CODE(A2),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"})在这个公式中,CODE函数旨在查询词语(字符串)第一个字符对应的数字代码,这些代码其实标明了这个汉字在代码库中的具体排位,LOOKP函数就根据不同音序汉字在代码库中的起始位置,获取到这个汉字的第一个字母了。
其中,A2是引用汉语字词所在的单元格名称,大家可获取字词前两个汉字所对应的第一个字母根据实际情况修改。二、如果你想获取词语第二个汉字对应的字母,可以将上述公式中的A2改为MID(A2,2,1),表示从字符串的第二个开始取的第一个,即第二个。
具体公式为:=LOOKUP(CODE(MID(A2,2,1)),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"})如果想取第三个可以以此类推,即:=LOOKUP(CODE(MID(A2,3,1)),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"})三、如果想获取前两个汉字音序怎么办?用“&”将获取第一、二个汉字音序的公式合并即可。 如果想获取前三个汉字音序就用“&”将获取第一、二、三个汉字音序的公式合并。
获取字符串前三个汉字音序的公式:=LOOKUP(CODE(A2),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"})&LOOKUP(CODE(MID(A2,2,1)),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"})&LOOKUP(CODE(MID(A2,3,1)),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"})。
3.提取表格中文字的首字母
你先用函数mid提取中文文字,再通过我找的别人提取中文字首字母的方法
先定义名称:插入-名称-定义
拼音={"","";"吖","A";"八","B";"嚓","C";"咑","D";"鵽","E";"发","F";"猤","G";"铪","H";"夻","J";"咔","K";"垃","L";"呒","M";"旀","N";"噢","O";"妑","P";"七","Q";"囕","R";"仨","S";"他","T";"屲","W";"夕","X";"丫","Y";"帀","Z"}
假设你的文字在A列第一行,B1写公式:
=VLOOKUP(LEFT(A1),拼音,2)&VLOOKUP(MID(A1,2,1),拼音,2)&VLOOKUP(MID(A1,3,1),拼音,2)&VLOOKUP(MID(A1,4,1),拼音,2)&VLOOKUP(MID(A1,5,1),拼音,2)&VLOOKUP(MID(A1,6,1),拼音,2)&VLOOKUP(MID(A1,7,1),拼音,2)&VLOOKUP(MID(A1,8,1),拼音,2)
这个公式可以取得前8的首字母,你可以根据实际需要修改。
最后100p和刚才的结果用&;连续一下。
4.怎样获取汉字的首字母
后面又提的问题,手工做只需选中ZGHT6Ha这一列复制,再另一列选择性粘贴->数值,再改就行了。
下面是一个VBA自定义函数,按ALT+F11,插入模块,在右面窗口中粘贴下面代码。若B10内容为 中国航天6号a,则在某空白格中输入:=hztopy(B10) 即可Function hztopy(hzpy As String) As String Dim hzstring As String, pystring As String Dim hzpysum As Integer, hzi As Integer, hzpyhex As Integer hzstring = Trim(hzpy) hzpysum = Len(Trim(hzstring)) pystring = "" For hzi = 1 To hzpysum hzpyhex = "&H" + Hex(Asc(Mid(hzstring, hzi, 1))) Select Case hzpyhex Case &HB0A1 To &HB0C4: pystring = pystring + "A" Case &HB0C5 To &HB2C0: pystring = pystring + "B" Case &HB2C1 To &HB4ED: pystring = pystring + "C" Case &HB4EE To &HB6E9: pystring = pystring + "D" Case &HB6EA To &HB7A1: pystring = pystring + "E" Case &HB7A2 To &HB8C0: pystring = pystring + "F" Case &HB8C1 To &HB9FD: pystring = pystring + "G" Case &HB9FE To &HBBF6: pystring = pystring + "H" Case &HBBF7 To &HBFA5: pystring = pystring + "J" Case &HBFA6 To &HC0AB: pystring = pystring + "K" Case &HC0AC To &HC2E7: pystring = pystring + "L" Case &HC2E8 To &HC4C2: pystring = pystring + "M" Case &HC4C3 To &HC5B5: pystring = pystring + "N" Case &HC5B6 To &HC5BD: pystring = pystring + "O" Case &HC5BE To &HC6D9: pystring = pystring + "P" Case &HC6DA To &HC8BA: pystring = pystring + "Q" Case &HC8BB To &HC8F5: pystring = pystring + "R" Case &HC8F6 To &HCBF9: pystring = pystring + "S" Case &HCBFA To &HCDD9: pystring = pystring + "T" Case &HEDC5: pystring = pystring + "T" Case &HCDDA To &HCEF3: pystring = pystring + "W" Case &HCEF4 To &HD1B8: pystring = pystring + "X" Case &HD1B9 To &HD4D0: pystring = pystring + "Y" Case &HD4D1 To &HD7F9: pystring = pystring + "Z" Case Else pystring = pystring + Mid(hzstring, hzi, 1) End Select Next hztopy = pystringEnd Function。
5.EXCEL 怎么提取单元格汉字首字母
在EXECL中 ,按ALT+F11,插入---模块 复制下列代码 :
Function hztopy(hzpy As String) As String
Dim hzstring As String, pystring As String
Dim hzpysum As Integer, hzi As Integer, hzpyhex As Integer
hzstring = Trim(hzpy)
hzpysum = Len(Trim(hzstring))
pystring = ""
For hzi = 1 To hzpysum
hzpyhex = "&H" + Hex(Asc(Mid(hzstring, hzi, 1)))
Select Case hzpyhex
Case &HB0A1 To &HB0C4: pystring = pystring + "A"
Case &HB0C5 To &HB2C0: pystring = pystring + "B"
Case &HB2C1 To &HB4ED: pystring = pystring + "C"
Case &HB4EE To &HB6E9: pystring = pystring + "D"
Case &HB6EA To &HB7A1: pystring = pystring + "E"
Case &HB7A2 To &HB8C0: pystring = pystring + "F"
Case &HB8C1 To &HB9FD: pystring = pystring + "G"
Case &HB9FE To &HBBF6: pystring = pystring + "H"
Case &HBBF7 To &HBFA5: pystring = pystring + "J"
Case &HBFA6 To &HC0AB: pystring = pystring + "K"
Case &HC0AC To &HC2E7: pystring = pystring + "L"
Case &HC2E8 To &HC4C2: pystring = pystring + "M"
Case &HC4C3 To &HC5B5: pystring = pystring + "N"
Case &HC5B6 To &HC5BD: pystring = pystring + "O"
Case &HC5BE To &HC6D9: pystring = pystring + "P"
Case &HC6DA To &HC8BA: pystring = pystring + "Q"
Case &HC8BB To &HC8F5: pystring = pystring + "R"
Case &HC8F6 To &HCBF9: pystring = pystring + "S"
Case &HCBFA To &HCDD9: pystring = pystring + "T"
Case &HEDC5: pystring = pystring + "T"
Case &HCDDA To &HCEF3: pystring = pystring + "W"
Case &HCEF4 To &HD1B8: pystring = pystring + "X"
Case &HD1B9 To &HD4D0: pystring = pystring + "Y"
Case &HD4D1 To &HD7F9: pystring = pystring + "Z"
Case Else
pystring = pystring + Mid(hzstring, hzi, 1)
End Select
Next
hztopy = pystring
End Function
比如在A1输入 小燕子耳坠子7.8 则在其他空白单元格输入 =hztopy(A1) 回车执行即可.
6.excel中如何实现提取汉字的拼音首字母
在EXECL中 ,按ALT+F11,插入---模块 复制下列代码 :Function hztopy(hzpy As String) As StringDim hzstring As String, pystring As StringDim hzpysum As Integer, hzi As Integer, hzpyhex As Integerhzstring = Trim(hzpy)hzpysum = Len(Trim(hzstring))pystring = ""For hzi = 1 To hzpysum hzpyhex = "&H" + Hex(Asc(Mid(hzstring, hzi, 1))) Select Case hzpyhex Case &HB0A1 To &HB0C4: pystring = pystring + "A" Case &HB0C5 To &HB2C0: pystring = pystring + "B" Case &HB2C1 To &HB4ED: pystring = pystring + "C" Case &HB4EE To &HB6E9: pystring = pystring + "D" Case &HB6EA To &HB7A1: pystring = pystring + "E" Case &HB7A2 To &HB8C0: pystring = pystring + "F" Case &HB8C1 To &HB9FD: pystring = pystring + "G" Case &HB9FE To &HBBF6: pystring = pystring + "H" Case &HBBF7 To &HBFA5: pystring = pystring + "J" Case &HBFA6 To &HC0AB: pystring = pystring + "K" Case &HC0AC To &HC2E7: pystring = pystring + "L" Case &HC2E8 To &HC4C2: pystring = pystring + "M" Case &HC4C3 To &HC5B5: pystring = pystring + "N" Case &HC5B6 To &HC5BD: pystring = pystring + "O" Case &HC5BE To &HC6D9: pystring = pystring + "P" Case &HC6DA To &HC8BA: pystring = pystring + "Q" Case &HC8BB To &HC8F5: pystring = pystring + "R" Case &HC8F6 To &HCBF9: pystring = pystring + "S" Case &HCBFA To &HCDD9: pystring = pystring + "T" Case &HEDC5: pystring = pystring + "T" Case &HCDDA To &HCEF3: pystring = pystring + "W" Case &HCEF4 To &HD1B8: pystring = pystring + "X" Case &HD1B9 To &HD4D0: pystring = pystring + "Y" Case &HD4D1 To &HD7F9: pystring = pystring + "Z" Case Else pystring = pystring + Mid(hzstring, hzi, 1) End SelectNexthztopy = pystringEnd Function 比如在A1输入 小燕子耳坠子7.8 则在其他空白单元格输入 =hztopy(A1) 回车执行即可.。
最新内容
手机 |
相关内容
在wps表格中下标 | wps里下标的下
在wps表格中下标 【wps里下标的下标打】,下标,表格中,输入,怎么打,教程,模板,1.wps里下标的下标怎么打在WPS文字中,下标的下标可以通在wps上调整表格间距 | wps文档里
在wps上调整表格间距 【wps文档里用表格调行间距】,表格,行间距,怎么设置,文档,调整,行高,1.wps文档里用表格怎么调行间距首先打开wps数字转换为文本 | 将wps表格中
wps数字转换为文本 【将wps表格中的数值转换为文本形式】,文本,文本格式,表格中,数字,教程,字变,1.怎样将wps表格中的数值转换为文wps中输入r加圈 | 在word中输入大
wps中输入r加圈 【在word中输入大写R外加一个圈】,文字,输入,字符,怎么输入,插入,加圈,1.在word中如何输入大写R外加一个圈在word中用wps进行筛选 | 用WPS表格筛选出
用wps进行筛选 【用WPS表格筛选出我想要的】,筛选,表格,怎么设置,功能,表格筛选,怎么用,1.怎么用WPS表格筛选出我想要的1.首先选中wps空白表格默认 | wps表格修改默
wps空白表格默认 【wps表格修改默认设置】,修改,表格,默认,模板,教程,双击,1.wps表格怎样修改默认设置第一种方法:默认页面设置法 新在wps文档中插入四方体 | 在wps文
在wps文档中插入四方体 【在wps文字里输入方框符号】,文字,输入,方框符号,文档,插入,怎样插入,1.如何在wps文字里输入方框符号操作手机版wps表格截图快捷键 | 在WPS
手机版wps表格截图快捷键 【在WPS表格里快速截图】,表格,快速截图,文档,截图,手机版,选择,1.如何在WPS表格里快速截图1、选择你所需