?
Solved

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

Posted on 2015-01-23
7
Medium Priority
?
135 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 2000 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 34

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 27

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 34

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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

839 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