# Thread: Extract Only Numbers From Text String Thanks: 0 Likes:  3 Post #2195604 (1)Post #2194891 (1)Post #2195554 (1)

1. ## Re: Extract Only Numbers From Text String

ok - I just try #37 and was able to make it work. Probably input error that it did not work the first time. Thank you for the suggestion.

2. ## Re: Extract Only Numbers From Text String

The only problem with that Formula in #37 is it will return a number, so any leading zero will be by pass

3. ## Re: Extract Only Numbers From Text String

Hi, i got a question here regarding for extracting the only number. But how about fraction? I would like to extract this.

 E.g. Flamengo (2/13) to only 2/13 Any idea?

4. ## Re: Extract Only Numbers From Text String

Originally Posted by oddchecker
Hi, i got a question here regarding for extracting the only number. But how about fraction? I would like to extract this.

 E.g. Flamengo (2/13) to only 2/13 Any idea?
Unfortunately one example is usually not enough to decide on a course of action...

Is the number always at the end of the text as shown in your example? If not, can other numbers (digits) be located after it?

Is the number always surrounded by parentheses? If so, will those parentheses always be the only parentheses in the text?

Can there be any other numbers (digits) located before the number you want?

5. ## Re: Extract Only Numbers From Text String

Originally Posted by oddchecker
Hi, i got a question here regarding for extracting the only number. But how about fraction? I would like to extract this.

 E.g. Flamengo (2/13) to only 2/13 Any idea?

use this UDF

Code:
```Function RemoveApha(cellInput) As String
Set cellInput = Intersect(cellInput.Parent.UsedRange, cellInput)

For i = 1 To Len(cellInput)
Select Case Mid(cellInput, i, 1)
Case 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, " ", "-", "/"
Charval = Mid(cellInput, i, 1)
Case Else
Charval = ""
End Select
RemoveApha = RemoveApha & Charval
Next i

End Function```

6. ## Re: Extract Only Numbers From Text String

Originally Posted by jamilm
use this UDF
Try your UDF with this text "a1b2c3d(2/3)e4" and you will see why I asked the questions that I did in Message #44.

7. ## Re: Extract Only Numbers From Text String

Originally Posted by Rick Rothstein
Try your UDF with this text "a1b2c3d(2/3)e4" and you will see why I asked the questions that I did in Message #44.

Hi Rick,

i used the UDF and i got
 1232/34

i thought the oddchecker is looking for to remove all normal alpha char and then retain numbers and that special chars.

or perhaps i misunderstood.

8. ## Re: Extract Only Numbers From Text String

Originally Posted by jamilm
Hi Rick,

i used the UDF and i got
 1232/34

i thought the oddchecker is looking for to remove all normal alpha char and then retain numbers and that special chars.

or perhaps i misunderstood.
I got the impression he was looking for a specific number. Because of our different interpretations is why I said "Unfortunately one example is usually not enough to decide on a course of action..." The question comes up, though... if the OP really wanted numbers only, then why keep the slash? What about decimal points, thousands separators, plus minus signs, currency symbols, etc. Hopefully the OP will be along shortly to clarify what his question actually is.

9. ## Re: Extract Only Numbers From Text String

Thanks Seniors for your great formulas.

I am looking for if this brain storming can provide me an answer for this 'text string' as well.

Fail David Simon; if achieved of marks 560: St. John College _______I want 560 in B1

Pass Julie D'souza of high school; if got marks 75: Michigan College_______I want 75 in B2

Regards
Ravinder Ozha, PhD

10. ## Re: Extract Only Numbers From Text String

@ravinderozha

The formula in post #37 works fine.