单元格举例:
文字文字1641+244 提取后:1641244
g194+575120文(文字文字) 提取后:194575
提取"+"号左边4位,右边3位数字
再给一个提取数字的公式
cy_dancer 大哥vba怎么用啊,我想对J:J这列转换
要是有提取数字的公式也可以
运行后下标越界,不知道是不是遇到这种单元格:1+258字符字符
楼上那个用公式不能完全实现要求,你把字母也给显示出来了!!!
单纯用公式可能比较困难,需要用VBA
J:J列的话,我把程序改了一下。至于VBA怎么用,VBA就是指用Excel的宏。具体用法用文字不太好说明阿!你慧缓唤在菜单栏右键鼠标,选宏,也就是visual basic。会弹出一个工具条,然后点visual basic editor。然后把我的代码贴到里面。
同时前凯修改我代码里面"sheet1"成你实际的sheet名。保存,然后alt + F8.
Sub listGet()
columnNum = ThisWorkbook.Sheets("sheet1").Range("哪睁J:J")
For i = 1 To UBound(columnNum)
aa = getNum(columnNum(i, 1))
ThisWorkbook.Sheets("sheet1").Range("K" & i).Value = aa
Next
End Sub
Function getNum(ByVal str As String)
Dim n As Integer
Dim strs() As String
Dim nums() As String
n = InStr(str, "+")
If n > 0 Then
ReDim nums(n - 1) As String
strs = Split(str, "+")
For i = 0 To UBound(strs) - 1
getNum = getNum & getBeginStr(strs(i)) & getEndStr(strs(i + 1))
Next
End If
End Function
Function getBeginStr(ByVal bstr As String)
Dim x As Integer
Dim cnt As Integer
getBeginStr = ""
x = 4
cnt = 0
If Len(bstr) < 4 Then
x = Len(bstr)
End If
For i = 1 To x
a = Mid(bstr, Abs(i - x) + 1, 1)
If IsNumeric(a) Then
cnt = cnt + 1
Else
Exit For
End If
Next
If cnt > 0 Then
getBeginStr = Right(bstr, cnt)
End If
End Function
Function getEndStr(ByVal estr As String)
Dim x As Integer
Dim cnt As Integer
getEndStr = ""
x = 3
cnt = 0
If Len(estr) < 3 Then
x = Len(estr)
End If
For i = 1 To x
a = Mid(estr, i, 1)
If IsNumeric(a) Then
cnt = cnt + 1
Else
Exit For
End If
Next
If cnt > 0 Then
getEndStr = Left(estr, cnt)
End If
End Function
=MID(A1,FIND("+",A1)-4,4)&MID(A1,FIND("+",A1)+1,3)
没了上面已经说了
如果你会vf那就简单多了.
如何把表格禅坦中的数冲袭备字单独提取出散毁来呢?用复制-粘贴就能搞定。