Link to home
Start Free TrialLog in
Avatar of PeterBaileyUk
PeterBaileyUk

asked on

extract numeric from text string

I have text strings and I would like to be able to extract only the number contained within.

ie
GSX-R 1100 M (GSX-R M), GSX-R 1100 N (GSX-R N) = 1100
GSX 750/K1/W/X/Y= 750

GZ 125 K=125

am with microsoft 365 version and working in query grid.

help would be appreciated.
ASKER CERTIFIED SOLUTION
Avatar of Joe Howard
Joe Howard
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Function ExtractNumbers(ByVal str As String) As String
    num = ""
    For x As Integer = 0 To str.Length - 1
        If IsNumeric(str.Substring(x, 1)) Then num = num & str.Substring(x, 1)
    Next
    return num
End Function

Open in new window

Avatar of PeterBaileyUk
PeterBaileyUk

ASKER

thx