On 4 Aug 2005 09:21:11 -0700, "Harlan Grove" <hrlngrv@aol.com> wrote:
>Stephen R wrote...
>>I have output data from a program, .txt files, with multiple lines of text
>>with one or two numbers on each line. The number I want to isolate is
>>always in-between a descriptor, like x or y, then a units descriptor at the
>>end, like lbm^2. Here are some example lines from the output file.
>>
>> I 676158.2296 lbm in^2
>>
>> Axis
>>
>> X 0.9881 in
>>
>> Y -0.0059 in
>>
>> Z -0.1538 in
>>
>>The numbers do have a variable number of decimal places, like 0.9881 or
>>0.99, so the number of characters in each line can vary.
>
>If the number is always the second space-separated field, it'd be
>easiest to copy cells like this and use Data > Text to Columns on the
>copy, using the Delimited option with space as a field delimiter, then
>use the 3rd step of the wizard to skip all but the second field.
>
>You could also isolate the second space-separated field with formulas.
>
>=LEFT(TRIM(MID(x,FIND(" ",x&" ")+1,256)),
>FIND(" ",TRIM(MID(x,FIND(" ",x&" ")+1,256))&" ")-1)
I like both of your approaches. But for the second, I would suggest a slight
modification:
=LEFT(MID(TRIM(x),FIND(" ",TRIM(x)&" ")+1,256),
FIND(" ",MID(TRIM(x),FIND(" ",TRIM(x)&" ")+1,256)&" ")-1)
only because when I copied the OP's data, there were leading spaces on some of
the strings, and the above enables your formula to work with or without leading
spaces.
--ron
Bookmarks