Solved

I need an excel formula or macro for extracting one string of numbers that resides between  parenthesis

Posted on 2015-01-23
7
124 Views
Last Modified: 2015-01-23
I have a column of names with corresponding id numbers - I need to extract only the numbers from this column..  

example

Smith, Jane (2342)
Litton, Keely (9890)
Huffman, Rosemary (98999)
Easterling, William (1234557)

Data is in column B and I want them to appear on the same worksheet in column A, right next to the name, on the same row).
What formula should I use, or is there a macro for stripping these  numbers out in one easy step?
0
Comment
Question by:klitton7
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 500 total points
ID: 40566414
=VALUE(MID(A1,FIND("(",A1)+1,FIND(")",A1)-FIND("(",A1)-1))
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40566416
Assuming it is in A1.
0
 

Author Comment

by:klitton7
ID: 40566426
Perfect!  Thanks Phillip
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 32

Expert Comment

by:Rob Henson
ID: 40566431
You could also use the Text to Column function to split the values across two columns.

The result will still have the closing bracket after the number but a Find and Replace can soon get rid of those. The result will also then be a text value but I guess as its a Personnel ID you wouldn't need to be doing any mathematical functions on it. If then used in subsequent lookups and such like, the lookup function will have to allow for the ID being text.

Thanks
Rob H
0
 
LVL 25

Expert Comment

by:ProfessorJimJam
ID: 40566435
here is another version, in case if sometimes your numbers are not within parenthesis

=SUM(MID(0&A1,LARGE(ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))*ROW(INDIRECT("1:"&LEN(A1))),ROW(INDIRECT("1:"&LEN(A1))))+1,1)*10^ROW(INDIRECT("1:"&LEN(A1)))/10)

press with Control Shift Enter
0
 

Author Comment

by:klitton7
ID: 40566532
Rob - thanks for your comment.  I had been using that process, but found it too cumbersome.

Also Thanks also to Professorlimlam...  in this particular instance, the numbers are always inside parenthesis, but I will hold on to this formula for future reference.  

Many thanks!
0
 
LVL 32

Expert Comment

by:Rob Henson
ID: 40566603
Using just the one formula above will only split the numbers into a separate cell; result being name with number in one cell and just number in adjacent cell.

If you want to split the values into two, ie name in one cell and number in another, you will need an additional formula for that. The results can then be copied and pasted as values.

To split out just the name:

=TRIM(LEFT(B2,FIND("(",B2,1)))

Thanks,
Rob H
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

775 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question