ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Parseing Text strings (https://www.excelbanter.com/excel-discussion-misc-queries/108558-parseing-text-strings.html)

[email protected]

Parseing Text strings
 
I need to take a text string that has a Stock Option description in a
text string (i.e. ADM Dec 2006 40.0000 put). I want to divide up the
text string and have each word in its own cell. I can not figure out
how to do it. Problems arise b/c the stock symbol can have one to four
characters (i.e. X or MSFT).

What is the best way to do it so it automatically does it? I would
prefer to use some sort of function that counts the spaces and gives
the next word or something like that.

DM


Pete_UK

Parseing Text strings
 
Highlight the column with the data in and use Data | Text-to-columns
specifying a space as the delimiter. Your date will be split, but you
can easily recombine this if you want to.

Hope this helps.

Pete

wrote:
I need to take a text string that has a Stock Option description in a
text string (i.e. ADM Dec 2006 40.0000 put). I want to divide up the
text string and have each word in its own cell. I can not figure out
how to do it. Problems arise b/c the stock symbol can have one to four
characters (i.e. X or MSFT).

What is the best way to do it so it automatically does it? I would
prefer to use some sort of function that counts the spaces and gives
the next word or something like that.

DM



Dave F

Parseing Text strings
 
Given that the number of characters in the ticker symbol changes, the way I
would do it is Data--text to columns.
--
Brevity is the soul of wit.


" wrote:

I need to take a text string that has a Stock Option description in a
text string (i.e. ADM Dec 2006 40.0000 put). I want to divide up the
text string and have each word in its own cell. I can not figure out
how to do it. Problems arise b/c the stock symbol can have one to four
characters (i.e. X or MSFT).

What is the best way to do it so it automatically does it? I would
prefer to use some sort of function that counts the spaces and gives
the next word or something like that.

DM



[email protected]

Parseing Text strings
 

Thanks Pete,

That will work but I need a more dynamic solution.
The option text string is generated by a quote service and insterted in
the cell.
I need it then to be devided up and spread throught my spreadsheet.
I really need it to be done automaticly b/c I don't want the final
users of the spreadsheet to mess with the backend of my work.

Dan


[email protected]

Parseing Text strings
 

Thanks,

That will work but I need a more dynamic solution.
The option text string is generated by a quote service and insterted in
the cell.
I need it then to be devided up and spread throught my spreadsheet.
I really need it to be done automaticly b/c I don't want the final
users of the spreadsheet to mess with the backend of my work.

Dan


Ron Rosenfeld

Parseing Text strings
 
On 5 Sep 2006 09:36:58 -0700, wrote:

I need to take a text string that has a Stock Option description in a
text string (i.e. ADM Dec 2006 40.0000 put). I want to divide up the
text string and have each word in its own cell. I can not figure out
how to do it. Problems arise b/c the stock symbol can have one to four
characters (i.e. X or MSFT).

What is the best way to do it so it automatically does it? I would
prefer to use some sort of function that counts the spaces and gives
the next word or something like that.

DM


The simplest way to do it with functions is to download and install Longre's
free morefunc.xll add-in from
http://xcell05.free.fr/

Then, with your data in A1:An, enter the following:

B1: =REGEX.MID($A1,"\S+",COLUMNS($A:A))

copy/drag across to F1.

Select B1:F1 and copy drag down to Row n.

The problem can also be solved with native functions, but the formulas are more
complex.
--ron

[email protected]

Parseing Text strings
 
Thanks Ron.


Ron Rosenfeld

Parseing Text strings
 
On 5 Sep 2006 13:39:48 -0700, wrote:

Thanks Ron.


You're welcome. Glad to help.

Lot's of other good functions in that add-in.


--ron

Ron Rosenfeld

Parseing Text strings
 
On 5 Sep 2006 13:39:48 -0700, wrote:

Thanks Ron.


By the way, the example I gave just puts it into sequential columns.

To put it into different cells, the third argument ...,columns($A:A)) is the
index number to tell which "word" to parse out. When you drag it across the
row, it reduces to 1 or 2 or 3 or n depending on where you are.

So the first word, that argument would be a 1; word 2 -- 2; etc. You can hard
code it if my method is not appropriate.


--ron


All times are GMT +1. The time now is 10:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com