excel表格怎么设置提取数字
时间:2022-10-05 22:44:38
当我们在使用Excel进行办公的时候,我们可能会遇到一些数据需要进行特殊提取的情况,下面小编马上就告诉大家excel怎么提取数字吧,希望看完本教程的朋友都能学会并运用起来。
excel设置提取数字的办法
1、汉字在前,数字在后面的情形。可以用MID,min, find三个函数来实现提取里面的数字。如图:在B2输入“=MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),20)”
2 、把单元格里面所有的数字都提出来。可以使用宏。先打开VBA编辑器。工具——宏——visual basic 编辑器
3、在编辑器里点击插入——模块。在模块那里输入如下代码:
复制内容到剪贴板
Function zzsz(xStr As String) As StringDim i As IntegerFor i = 1 To Len(xStr)If IsNumeric(Mid(xStr, i, 1)) Then zzsz = zzsz & Mid(xStr, i, 1)NextEnd Function
4、回到工作表,在B2单元格那里输入“=zzsz(A2)”。就可以用VBA把A2单元格里所有的数字都提取出来了,如图所示。
5、指定从第几个数组提取开始。也就是说在不连续的那些数字中,从第几次出现的数组开始提取。同样在模块那里输入如下代码:
复制内容到剪贴板
Function GetNums(rCell As Range, num As Integer) As StringDim Arr1() As String, Arr2() As StringDim chr As String, Str As StringDim i As Integer, j As IntegerOn Error GoTo line1
Str = rCell.TextFor i = 1 To Len(Str)chr = Mid(Str, i, 1)If (Asc(chr) < 48 Or Asc(chr) > 57) ThenStr = Replace(Str, chr, " ")End IfNext
Arr1 = Split(Trim(Str))ReDim Arr2(UBound(Arr1))For i = 0 To UBound(Arr1)If Arr1(i) <> "" ThenArr2(j) = Arr1(i)j = j + 1End IfNext
GetNums = IIf(num <= j, Arr2(num – 1), "")line1:End Function
6、在回到单元格那里输入“=Getnums(A3,2)”就可以提取第几次出现的数组了,如图所示。
猜你感兴趣:
1.excel怎么提取数字
2.excel如何提取数字
3.excel表格中怎样提取数字
4.Excel表格中如何在一串数字中提取几位数字
5.怎么在excel中提取数字
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
word2013中多级编号变成黑块的该怎么处理?
excel中姓怎么提取?
![](https://img.aspxhome.com/file/2023/3/36463_0s.jpg)
Word页码从第三页开始详细的图文步骤教程
![](https://img.aspxhome.com/file/2023/9/21959_0s.png)
安装Win10 21H1出现Bug怎么应对?
![](https://img.aspxhome.com/file/2023/0/50850_0s.png)
在Word2016中快速编辑PDF格式文档
![](https://img.aspxhome.com/file/2023/9/23769_0s.png)
win10截图无法保存_win10截图保持教程
![](https://img.aspxhome.com/file/2023/7/48537_0s.jpg)
word批注怎么隐藏
![](https://img.aspxhome.com/file/2023/1/34511_0s.gif)
win10你要允许此应用对你的设备进行更改吗怎么关闭?
![](https://img.aspxhome.com/file/2023/2/53332_0s.jpg)
wps演示文稿设置背景的方法
![](https://img.aspxhome.com/file/2023/9/a164049_0s.jpg)
怎样对Excel2003文件加密
![](https://img.aspxhome.com/file/2023/9/38789_0s.jpg)
同样是Word办公,为什么别人的效率比你高?
![](https://img.aspxhome.com/file/2023/9/22489_0s.gif)
Win10电脑虚拟内存应该怎么设置?虚拟内存怎么设置比较合适?
![](https://img.aspxhome.com/file/2023/8/50348_0s.png)
excel表格批注不显示的解决教程
Excel文档编辑里面"填空型"下划线地运用
![](https://img.aspxhome.com/file/2023/6/38856_0s.jpg)
excel行高怎么统一设置
![](https://img.aspxhome.com/file/2023/5/55195_0s.gif)
word文档如何设置目录
Word中设置视图页面的操作方法
安装Office 2013专业版的过程中提示在安装过程中出错
![](https://img.aspxhome.com/file/2023/4/16554_0s.jpg)
文件误删不要怕,帮你找回Win10回收站清空文件
![](https://img.aspxhome.com/file/2023/4/48944_0s.jpg)
Word文档删除线怎么加
![](https://img.aspxhome.com/file/2023/9/17199_0s.png)