I have a column in an export of data which contains flight numbers which vary between 5 and 6 characters long. These alphanumeric strings can be in a varied format in that sometimes they are:
XX###
XX###A
XXX###
XXX##A
I have a function to allow me to keep just the text portion of the string which works beautifully, however after scouring the internet for a while I haven't been able to find an equivalent for the numerical portion.
Ideally I would like to keep it as a function, but I will consider using formulae as well although I had an issue whilst using the array formula from exceltools as it was giving me a NUM error which I couldn't seem to resolve:
XX###
XX###A
XXX###
XXX##A
I have a function to allow me to keep just the text portion of the string which works beautifully, however after scouring the internet for a while I haven't been able to find an equivalent for the numerical portion.
Code:
Function TextOnly(pWorkRng As Range) As String'Updateby20140515
Dim xValue As String
Dim OutValue As String
xValue = pWorkRng.Value
For xIndex = 1 To VBA.Len(xValue)
If Not VBA.IsNumeric(VBA.Mid(xValue, xIndex, 1)) Then
OutValue = OutValue & VBA.Mid(xValue, xIndex, 1)
End If
Next
TextOnly = OutValue
End Function
Ideally I would like to keep it as a function, but I will consider using formulae as well although I had an issue whilst using the array formula from exceltools as it was giving me a NUM error which I couldn't seem to resolve:
Code:
[B]=SUMPRODUCT(MID(0&A2,LA[/B][B]RG[/B][B]E(INDEX(ISNUMBER(--MID(A2,ROW($1:$25),1))* ROW($1:$25),0),ROW($1:$25))+1,1)*10^ROW($1:$25)/10)[/B]