excel中怎么让一个单元格内只显示数字?

如题所述

按ALT+F11,插入-模块,复制下列语句
Function SplitNumEng(str As String, sty As Byte)
Dim StrA As String
Dim StrB As String
Dim StrC As String
Dim i As Integer
Dim SigS As String
For i = 1 To Len(str)
SigS = Mid(str, i, 1)
If SigS Like "[a-zA-Z]" Then
StrA = StrA & SigS
ElseIf SigS Like "#" Then
StrB = StrB & SigS
Else
StrC = StrC & SigS
End If
Next i
Select Case sty
Case 1
SplitNumEng = StrA
Case 2
SplitNumEng = StrB
Case Else
SplitNumEng = StrC
End Select
End Function

D1
输入 =SplitNumEng(A1,2) 公式下拉 表示提取数字
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答