PDA

View Full Version : How to get the numbers from the data



idnoidno
07-21-2017, 12:34 AM
A field is the data, how to get the results of the C field

19832

YasserKhalil
07-21-2017, 01:09 AM
Try this UDF


Function AlphaNum(txt As String, Optional numOnly As Boolean = True) As String
txt = Split(Application.WorksheetFunction.Trim(txt), " ")(1)

With CreateObject("VBScript.RegExp")
.Pattern = IIf(numOnly = True, "\D+", "-?\d+(\.\d+)?")
.Global = True
AlphaNum = Trim(.Replace(txt, ""))
End With
End Function


To use it put this formula in E1 for example then drag

=VALUE(AlphaNum(A1))