View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default find % number from text string

The following UDF will display the percent value as a string:

Function percentality(s As String) As String
parts = Split(s, "%")
MsgBox (parts(0))
t = Right(parts(0), 2)
MsgBox (t)
If IsNumeric(t) Then
percentality = t & "%"
Exit Function
End If
t = Right(parts(0), 1)
If IsNumeric(t) Then
percentality = t & "%"
Exit Function
End If
percentality = ""
End Function

so if A1 contains:
there is 12% by volume
then
=percentality(A1) will display:
12%
as text

--
Gary''s Student - gsnu2007


"natek1234" wrote:

I am trying to come up with a formula to display a percentage in
another cell from a long string of other random text and if none to
show up at 0%. For example, the string in C1 is "(10%, 1, 15hr) blah
blah blah" i need a cell that finds the 10 and displays 10% and if
there is no % to display 0%. can anyone help me?