extracting the number from a cell

Joined
May 6, 2011
Messages
13
Reaction score
0
Hi, I have a cell in my workbook that has <=1.0%

the number in this is subject to change and I need to be able to extract the number from it.

I have tried mid(range("A1"), 3, 5) but as it is subject to change it could be edited so that it reads 1.05%, in which case I would have to go back into edit the vba, is it possible to just extract the number part instead of the <, =, % in vba
Cheers guys

CUDDIHY2K7 :)
 
Joined
Jun 27, 2011
Messages
5
Reaction score
0
Try this

Function removeSpecial(sInput As String) As String
Dim sSpecialChars As String
Dim i As Long
sSpecialChars = "\/:*?""<>|=%"
For i = 1 To Len(sSpecialChars)
sInput = Replace$(sInput, Mid$(sSpecialChars, i, 1), " ")
Next
removeSpecial = sInput
End Function

and in the cell where you want only # enter =SUBSTITUTE(removeSpecial(A1)," ","")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top