T
tahir4awan
I want to make a formula so that it can extract alphabets and number
from a string containing both alphabets and numbers
from a string containing both alphabets and numbers
I want to make a formula so that it can extract alphabets and numbers
from a string containing both alphabets and numbers.
Claus said:Hi,
Am Sun, 21 Oct 2012 03:24:08 +0000 schrieb tahir4awan:
-
where is the number in the string? Left, right, middle? Please post an
example of your strings.
Regards
Claus Busch
Here is the picture of the function
+-------------------------------------------------------------------+
|Filename: untitled.JPG |
|Download: http://www.excelbanter.com/attachment.php?attachmentid=639|
+-------------------------------------------------------------------+
in C2 try:
=--(MID(LEFT(A2,MAX(ISNUMBER(MID(A2,COLUMN(2:2),1)*1)*COLUMN(2:2))),MATCH(1,ISNUMBER(MID(A2&0,COLUMN(2:2),1)*1)*1,0),LEN(A2)))
Try a UDF
Function RemAlpha(str As String) As String
'Remove Alphas from a string
Dim re As Object
Set re = CreateObject("vbscript.regexp")
re.Global = True
re.Pattern = "\D"
RemAlpha = re.Replace(str, "")
End Function
Function RemDigits(str As String) As String
'Remove numbers from a string
Dim re As Object
Set re = CreateObject("vbscript.regexp")
re.Global = True
re.Pattern = "\d+"
RemDigits = re.Replace(str, "")
End Function
Gord