Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
No real need for code:
=--MID(LEFT(A1,FIND(")",A1)-1),FIND("(",A1)+1,255) where the -- coerces the Text returned by MID() to an XL number. However, if you need a UDF: Public Function ExtractNumberInParens( _ ByVal sInput As String) As Variant Dim sTemp As String If sInput Like "*(*)*" Then sTemp = Mid(Left(sInput, InStr(sInput, ")") - 1), _ InStr(sInput, "(") + 1) If IsNumeric(sTemp) Then ExtractNumberInParens = CDbl(sTemp) End If End If If IsEmpty(ExtractNumberInParens) Then _ ExtractNumberInParens = CVErr(xlErrValue) End Function In article , "Patrick" wrote: Hello everyone!! Need to create a custum function in Excel that will allow me to extra a series of numbers from a string. The string will have a fix format, so this should facilitate the process. The numbers im looking for are always going to be serounded by brakets. Ex: test(234)test2 From this example and using the brakets as guidlines, what type of code would be able to extract the '234' number. Thx for your hlp, Patrick |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Extracting Info From Within A Text String | Excel Worksheet Functions | |||
Extracting info from web pages | Excel Discussion (Misc queries) | |||
Extracting info to new tables | Excel Discussion (Misc queries) | |||
Extracting info from a database | Excel Programming | |||
extracting info the best way | Excel Programming |