A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

divide a string words separated by (number)



 
 
Thread Tools Display Modes
  #1  
Old June 3rd, 2010, 10:46 PM posted to microsoft.public.excel.misc
ferde
external usenet poster
 
Posts: 141
Default divide a string words separated by (number)

I would like to have the data that is in one cell parsed into two cells like
in the example below. The data is always separated by a consecutive whole
number in parenthesis . Thank you
A
(1.) White Dog (2.) Black Cat


A B
White Dog Black Cat
  #2  
Old June 3rd, 2010, 11:50 PM posted to microsoft.public.excel.misc
Don Guillett[_2_]
external usenet poster
 
Posts: 607
Default divide a string words separated by (number)

Sub SplitCellswith()
For Each n In Range("h2:h6")
c = Application.Substitute(n, " ", "")
p1 = InStr(1, Trim(c), ")")
p2 = InStr(p1 + 1, c, ")") + 1
p3 = InStr(p1 + 1, c, "(") - 1
n.Offset(, 1) = Mid(c, p2, 256)
n.Offset(, 0) = Mid(c, p1 + 1, p3 - p1)
Next n
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"ferde" wrote in message
...
I would like to have the data that is in one cell parsed into two cells
like
in the example below. The data is always separated by a consecutive whole
number in parenthesis . Thank you
A
(1.) White Dog (2.) Black Cat


A B
White Dog Black Cat


  #3  
Old June 4th, 2010, 01:08 AM posted to microsoft.public.excel.misc
Ron Rosenfeld[_2_]
external usenet poster
 
Posts: 9
Default divide a string words separated by (number)

On Thu, 3 Jun 2010 14:46:26 -0700, ferde
wrote:

I would like to have the data that is in one cell parsed into two cells like
in the example below. The data is always separated by a consecutive whole
number in parenthesis . Thank you
A
(1.) White Dog (2.) Black Cat


A B
White Dog Black Cat


B1:
=TRIM(MID(A1,FIND(")",A1)+1,FIND("(",A1,FIND("(",A 1)+1)-FIND(")",A1)-1))

C1:
=TRIM(MID(A1,FIND(")",A1,FIND(")",A1)+1)+1,255))

  #4  
Old June 4th, 2010, 01:33 AM posted to microsoft.public.excel.misc
ferde
external usenet poster
 
Posts: 141
Default divide a string words separated by (number)

Thank you for the help

"Don Guillett" wrote:

Sub SplitCellswith()
For Each n In Range("h2:h6")
c = Application.Substitute(n, " ", "")
p1 = InStr(1, Trim(c), ")")
p2 = InStr(p1 + 1, c, ")") + 1
p3 = InStr(p1 + 1, c, "(") - 1
n.Offset(, 1) = Mid(c, p2, 256)
n.Offset(, 0) = Mid(c, p1 + 1, p3 - p1)
Next n
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"ferde" wrote in message
...
I would like to have the data that is in one cell parsed into two cells
like
in the example below. The data is always separated by a consecutive whole
number in parenthesis . Thank you
A
(1.) White Dog (2.) Black Cat


A B
White Dog Black Cat


.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:11 AM.


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