Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
?
133 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 33

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 33

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

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!

Question has a verified solution.

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

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
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 will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

636 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