Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 87
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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,522
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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,045
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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 87
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


.

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
text string separated by comma Atishoo Excel Discussion (Misc queries) 6 February 12th 09 05:19 PM
Extracting text separated by | from string? JJFad Excel Discussion (Misc queries) 3 January 15th 09 12:43 PM
Excel 2003 - A string of #s needs to be separated into individual Sammy Excel Discussion (Misc queries) 3 March 21st 08 04:05 PM
MSExcel--words in a cell separated by comma need to be moved into. Gary in Alaska Excel Worksheet Functions 2 March 8th 05 08:45 PM
Divide one row over other row I dont wont to divide one number Rick Excel Discussion (Misc queries) 0 March 4th 05 07:13 PM


All times are GMT +1. The time now is 11:06 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"