Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Ron Rosenfeld
 
Posts: n/a
Default Parse contents of cell

On Tue, 28 Mar 2006 07:07:19 -0500, Ron Rosenfeld
wrote:

On Tue, 28 Mar 2006 02:52:18 -0600, Portuga
wrote:


Hi,

Bellow I have examples of contents of cells with DWH fields.
in Cell A1 I have:

Srce_Inst
Period_Dte
Srce_Cr_Grade
Cr_Grade_Qlfr_Cde
(Each DWH field in cell A1 is separated by breaks (Alt+Enter)

In cell A2 I have:
Acc_Setup_Dte, Contract_Eff_Dte, Period_Dte
(Each DWH field in cell A2 is separated by comas)


My question is:
Can I parse the contents of the cells?
I want each DWH field of cells A1 and A2 to be in different cells:


B1:Srce_Inst
B2:Period_Dte
B2:Srce_Cr_Grade
B4:Cr_Grade_Qlfr_Cde
B5:Acc_Setup_Dte
B6:Contract_Eff_Dte
B7:Period_Dte


thanks!


To accomplish exactly what you describe is fairly simple. Using Longre's free
morefunc.xll add-in from http://xcell05.free.fr/ and use regular expressions,
which can easily parse out the DWH fields:

B1: =REGEX.MID($A$1,"\w+",ROW())
copy/drag down to B4

B5: =REGEX.MID($A$2,"\w+",ROWS($1:1))
copy/drag down to B7

But I suspect there may be variations both in total number of entries and total
number of "phrases" within each entry.

To handle a varying number of "phrases" within each entry, you could do the
following:

B1:
=IF(ROW()<=REGEX.COUNT($A$1,"\w+"),
REGEX.MID($A$1,"\w+",ROW()),REGEX.MID(
$A$2,"\w+",ROW()-REGEX.COUNT($A$1,"\w+")))

copy/drag down as far as required.

To handle a range with more entries would be more complex in formulas, and
perhaps more easily handled in VBA.


--ron


To expand the above, if the total number of characters in the range is less
than 256, then

B1:
=REGEX.MID(MCONCAT(rng,","),"\w+",ROWS($1:1))

and copy/drag down as far as needed.

rng is the Range that you wish to parse out into the column. In your example,
it would be $A$1:$A$2.


--ron
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
Urgent date/scheduling calc needed jct Excel Worksheet Functions 3 February 24th 06 01:36 AM
Conversion of Cell Contents into a Functional Worksheet name ? GMJT Excel Worksheet Functions 1 August 21st 05 04:59 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM
How do I find the contents of a cell using the "ADDRESS" function. sweeney Excel Worksheet Functions 2 April 5th 05 03:23 AM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


All times are GMT +1. The time now is 05:48 PM.

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

About Us

"It's about Microsoft Excel"