Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Separating / extracting words within a cell

Hello,

I was wondering if there is a function similar to chunk expressions? In my
case I have cells in column A that start with a number and is followed by
sevral words. All I want to do is extract the number (as a number) and the
associated number in the column beside it into an array.

Column A Column B
145 This is a test 54
234 more of it 230

I would like an array for each cell in Range("A1:A300")

145,54
234,230
....
In some languages I would just use a "word" expression ... ie put word 1 of
cell A1 & "," and cell B1

Is there something similar in Excel?

thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Separating / extracting words within a cell

=left(A1,3) & "," & B1

if the number of digits could be variable

=Left(A1,find(" ",A1)-1) & "," & B1

assumet that formula is in C1. Select c1 and drag fill down the column.

--
Regards,
Tom Ogilvy


"Glen" wrote in message
...
Hello,

I was wondering if there is a function similar to chunk expressions? In my
case I have cells in column A that start with a number and is followed by
sevral words. All I want to do is extract the number (as a number) and the
associated number in the column beside it into an array.

Column A Column B
145 This is a test 54
234 more of it 230

I would like an array for each cell in Range("A1:A300")

145,54
234,230
...
In some languages I would just use a "word" expression ... ie put word 1
of
cell A1 & "," and cell B1

Is there something similar in Excel?

thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Separating / extracting words within a cell

Hi Tom,

Sorry that I had forgotten to mention that th enumbers were variable in
length but you caught it.

I am guessing that I might be able to create my own "chunk" function based
on what you have given ... ie so I could just input the number of "chunks"
that I want from a cell.

If true then is there a way to make it a global function or would I need to
put the code in each module?

thanks,

Glen
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Separating / extracting words within a cell

One other thought comes to mind. How to handle delimiters within text in
cells or variables.

Is it possible to define a globaldelimiter for example a "," or a "/".

thanks
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Separating / extracting words within a cell

If you are working in VBA, then use the SPLIT() function. It will both
separate a phrase into individual words/numbers and will allow arbitrary
field separators.
--
Gary's Student


"Glen" wrote:

One other thought comes to mind. How to handle delimiters within text in
cells or variables.

Is it possible to define a globaldelimiter for example a "," or a "/".

thanks



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Separating / extracting words within a cell

If you put it in a general module, it will be global to the workbook

If you put it in a general module, make the workbook and addin and then load
the addin, it will be global to any open workbooks - like the analysis
toolpak (which is an addin) when loaded.

Here is a link to an article on Addins

http://www.jkp-ads.com/articles/DistributeMacro00.htm

--
Regards,
Tom Ogilvy


"Glen" wrote in message
...
Hi Tom,

Sorry that I had forgotten to mention that th enumbers were variable in
length but you caught it.

I am guessing that I might be able to create my own "chunk" function based
on what you have given ... ie so I could just input the number of "chunks"
that I want from a cell.

If true then is there a way to make it a global function or would I need
to
put the code in each module?

thanks,

Glen



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting parts of a cell when only certain words appear Craig860 Excel Discussion (Misc queries) 4 September 6th 08 07:35 AM
Separating numbers and words into separate columns Windy Excel Discussion (Misc queries) 5 January 23rd 08 06:32 PM
Separating words in a single cell ibere Excel Discussion (Misc queries) 11 June 15th 06 10:14 PM
Separating Words From a Text String vqthomf Excel Programming 1 August 18th 05 12:31 PM
Extracting just the color words Mariela Excel Worksheet Functions 5 January 20th 05 08:07 AM


All times are GMT +1. The time now is 09:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"