Solved

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

Posted on 2015-01-23
7
119 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
Comment Utility
=VALUE(MID(A1,FIND("(",A1)+1,FIND(")",A1)-FIND("(",A1)-1))
0
 
LVL 24

Expert Comment

by:Phillip Burton
Comment Utility
Assuming it is in A1.
0
 

Author Comment

by:klitton7
Comment Utility
Perfect!  Thanks Phillip
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 31

Expert Comment

by:Rob Henson
Comment Utility
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
Comment Utility
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
Comment Utility
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 31

Expert Comment

by:Rob Henson
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now