View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Extracting number from Text and ()

On Thu, 8 Mar 2007 21:34:00 -0800, Confused
wrote:

In my worksheet, I have a series of strings that contain text, numbers and ().

For example,
In cell A1, string of text L(117),D(93),O(5).
In cell A2, string of text L(6),D(117),O(20)
In cell A3, string of text GRTR1%orYM(119),O(3).

The end result for each cell would be:

Column 1 Column 2 Column 3
Column 4
Result from Cell A1 117 93 5
Result from Cell A2 6 117 20
Result from Cell A3 3
119

Can anyone help me with a formula that produces the above results?
Any help is much appreciated !!



Here's one way with formulas:

Download and install Longre's free and easily distributable morefunc.xll add-in
from http://xcell05.free.fr

Then use this Regular Expression formula:

A2: =REGEX.MID($A1,"(?<=\()\d+(?=\))",COLUMNS($A:A))

Copy/drag across to column D
Copy/drag down as far as needed.

It picks out sequential integer numbers that are delineated by parentheses.

With regard to your A3 example, I note that you do NOT show the "1" as being
extracted, and I'm not sure of which columns for the location of 3 and 119. I
put them in the first two columns. If this is wrong, please post back with
more detail.
--ron