PDA

View Full Version : Solved: Extracting only part which is within brackats



jigar1276
07-19-2008, 03:09 AM
Hi Experts,

I have a cell with the value: "Team - I (LeaderName)".

I want a macro which should give me only the characters which are in between open bracket and close bracket, i.e. LeaderName.
LeaderName may have different lengths based on different team names (Team - I, Team - II, Team - III).

Thanks...
:help

xld
07-19-2008, 03:20 AM
You can do it without a macro

=MID(A20,FIND("(",A20)+1,FIND(")",A20)-FIND("(",A20)-1)

jigar1276
07-19-2008, 03:26 AM
Thanks Xld,

Actually i am using the extracted name in one of my macro. I tried the Find() within my main macro and it gave me error.

I was looking for the similar of Excel-Find to use in Macro.

xld
07-19-2008, 03:50 AM
Okay, same approach



With Range("A20")

ExtractedName = Mid(.Value, InStr(.Value, "(") + 1, InStr(.Value, ")") - InStr(.Value, "(") - 1)
End With

jigar1276
07-19-2008, 04:24 AM
Thats what i was looking for. It is working fine within my main macro code now.

Thanks Xld..:beerchug: :dau: