如何分离Excel单元格中的英文和汉字 图解教程
时间:2022-07-18 20:13:47
有时我们需要在Excel中将单元格中所包含的英文和中文分离出来,让分离出的中文和英文分别放到其他单元格中。如图:
假如A2单元格中包含中英文混合内容,可以用下面的方法来进行分离:
1.使用用公式:
在B2单元格中输入数组公式:
=MID(A2,MATCH(2,LENB(MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1)),0),LENB(A2)-LEN(A2))
公式输入完毕后按Ctrl+Shift+Enter结束。
在C2单元格中输入公式:
=TRIM(SUBSTITUTE(A2,B2,""))
2.使用自定义函数:
还可以在VBA中自定义一个函数,然后在Excel表格中使用该函数进行分离。方法是:按Alt+F11,打开VBA编辑器,单击菜单“插入→模块”,在右侧的代码窗口中输入下列代码:
Function SplitStringChs(TheString)
Dim n, Chs
For n = 1 To Len(TheString)
If Asc(Mid(TheString, n, 1)) < 0 Then
Chs = Chs & Mid(TheString, n, 1)
End If
Next
SplitStringChs = Chs
End Function
Function SplitStringEng(TheString)
Dim n, Eng
For n = 1 To Len(TheString)
If Asc(Mid(TheString, n, 1)) >= 0 Then
Eng = Eng & Mid(TheString, n, 1)
End If
Next
SplitStringEng = Trim(Eng)
End Function
关闭VBA编辑器,在B2单元格中输入公式:
=SplitStringChs(A2)
在C2单元格中输入公式:
=SplitStringeng(A2)
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Word2013文档首字下沉设置
![](https://img.aspxhome.com/file/2023/4/19724_0s.jpg)
Excel2007怎么制作跟随数据变化自动增加或删减的折线图?
![](https://img.aspxhome.com/file/2023/5/a141545_0s.png)
wps表格里面的求和公式是什么?
![](https://img.aspxhome.com/file/2023/1/53701_0s.jpg)
Excel 2019显示、隐藏特殊行列的操作方法图解教程
![](https://img.aspxhome.com/file/2023/0/a141080_0s.jpg)
excelsheet1不见了怎么办
SIGN函数的公式语法及使用方法实例
怎么把Word文档转换成PPT文稿?word转ppt
Word从任意页开始页码怎么设置
![](https://img.aspxhome.com/file/2023/2/17862_0s.jpg)
Excel2010误差线是黑色的如何更改其样式
![](https://img.aspxhome.com/file/2023/3/37943_0s.jpg)
大家可以检验一下我们公式是否正确
win7装完系统usb不能用怎么办?
![](https://img.aspxhome.com/file/2023/6/53176_0s.jpg)
Word2010屏幕截图插入功能如何使用的详细介绍
![](https://img.aspxhome.com/file/2023/9/29429_0s.jpg)
Win10检测不到音频输出设备
![](https://img.aspxhome.com/file/2023/1/53051_0s.jpg)
excel2003查找重复项的教程
word设置超链接跳转
excel如何设置自动填写序号
excel 如何拆分工作表
![](https://img.aspxhome.com/file/2023/1/a154931_0s.png)
通过Word文件收集信息 使用Excel自动摘录数据方法
![](https://img.aspxhome.com/file/2023/4/23804_0s.jpg)
Word2010中如何进行文档比较
![](https://img.aspxhome.com/file/2023/4/25274_0s.jpg)
在Word文本中打字后面的字却不见了是怎么回事?
![](https://img.aspxhome.com/file/2023/5/25365_0s.jpg)