excel提取字符串中数字、中文、英文字符的自定义函数
时间:2023-07-22 23:53:16
Function MyGet(Srg As String, Optional n As Integer = False)
‘n为1,取汉字,n为2,取字母,n为0,取数字
Dim i As Integer
Dim s, MyString As String
Dim Bol As Boolean
For i = 1 To Len(Srg)
s = Mid(Srg, i, 1)
If n = 1 Then
Bol = Asc(s) < 0 ‘文字
ElseIf n = 2 Then
Bol = s Like "[a-z,A-Z]" ‘字母
ElseIf n = 0 Then
Bol = s Like "#" ‘数字
End If
If Bol Then MyString = MyString & s
Next
MyGet = IIf(n = 1 Or n = 2, MyString, Val(MyString))
End Function
标签:函数,字母,数字,汉字,Excel函数
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
WPS表格如何设置排序图文教程
2022-03-01 15:47:18
网速不稳定是什么原因?网速不稳定的解决方法
2022-03-11 08:14:34
![](https://img.aspxhome.com/file/2023/3/a299694_0s.jpg)
wps文字怎样设置背景图片
2022-12-19 18:18:48
2021年5月最新桌面Intel/AMD对比CPU性能天梯图!
2023-04-25 14:08:40
![](https://img.aspxhome.com/file/2023/6/a322479_0s.jpg)
kb5008212卸载不掉怎么办?Win10强制卸载kb5008212
2022-06-07 12:41:07
![](https://img.aspxhome.com/file/2023/25/a218338_0s.png)
怎样在Word2003文档中添加书签
2022-07-10 03:39:45
![](https://img.aspxhome.com/file/2023/2/29872_0s.jpg)
怎么取消Win10系统开始菜单中的软件图标
2023-08-22 17:47:46
![](https://img.aspxhome.com/file/2023/26/a226746_0s.jpg)
移动硬盘在Mac电脑显示不出来如何解决?
2023-08-04 20:38:03
![](https://img.aspxhome.com/file/2023/0/a203060_0s.jpeg)
word怎么删除所有数字?
2023-06-03 10:17:14
![](https://img.aspxhome.com/file/2023/3/34743_0s.gif)
2345浏览器怎么截图 2345浏览器截图教程
2023-03-11 20:50:30
![](https://img.aspxhome.com/file/2023/8/a338455_0s.jpg)
Win10笔记本检测不到耳机怎么办?
2022-12-03 00:28:58
![](https://img.aspxhome.com/file/2023/26/a223582_0s.png)
win10电脑以太网没有Internet如何解决
2022-05-29 12:56:02
![](https://img.aspxhome.com/file/2023/4/a308261_0s.png)
搜狗输入法怎么把手写输入放在桌面?
2022-02-20 19:13:53
![](https://img.aspxhome.com/file/2023/1/a274319_0s.jpg)
旧版组件DirectPlay怎么安装?Win10/Win11安装教程
2023-06-12 06:57:42
![](https://img.aspxhome.com/file/2023/6/a321783_0s.png)
wps文字怎么设计模板图文教程
2023-04-22 02:38:54
Epic错误回复请刷新界面的五种解决方法
2022-12-26 15:22:50
![](https://img.aspxhome.com/file/2023/7/a327019_0s.png)
Word文字怎么添加外边框?Word文字加矩形边框的技巧
2022-08-16 05:32:56
![](https://img.aspxhome.com/file/2023/4/30814_0s.jpg)
Word中的8个技巧,都很实用,收藏!
2022-12-09 19:25:06
![](https://img.aspxhome.com/file/2023/4/22444_0s.gif)
笔记本电脑没有声音怎么办?
2022-05-24 11:11:03
![](https://img.aspxhome.com/file/2023/9/a343599_0s.jpg)
电脑安装后的软件不在桌面怎么办?win11安装后的软件不在桌面解决方法
2023-01-27 01:46:01
![](https://img.aspxhome.com/file/2023/28/a240659_0s.jpg)