Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Doug Benjamin
 
Posts: n/a
Default Split cell without breaking word?


What I want to do is split up a cell of about 25-60 characters into two
cells without ending up with words cut in half or duplicated words. I
want the first 30 characters in the first cell and the rest if any in
the second cell. Any Ideas?


--
Doug Benjamin
------------------------------------------------------------------------
Doug Benjamin's Profile: http://www.excelforum.com/member.php...o&userid=33407
View this thread: http://www.excelforum.com/showthread...hreadid=532285

  #2   Report Post  
Posted to microsoft.public.excel.misc
Toppers
 
Posts: n/a
Default Split cell without breaking word?

Assuming text is words separated by blanks:

Dim v As Variant
Dim str1 As String, str2 As String
Dim fstr As Boolean
v = Split(Textstring," ")
str1 = ""
str2 = ""
fstr = True
For i = LBound(v) To UBound(v)
If Len(str1) + Len(v(i)) 30 Then fstr = False
If fstr Then
str1 = str1 + v(i) + " "
Else
str2 = str2 + v(i) + " "
End If
Next i
MsgBox str1 & " / " & str2

"Doug Benjamin" wrote:


What I want to do is split up a cell of about 25-60 characters into two
cells without ending up with words cut in half or duplicated words. I
want the first 30 characters in the first cell and the rest if any in
the second cell. Any Ideas?


--
Doug Benjamin
------------------------------------------------------------------------
Doug Benjamin's Profile: http://www.excelforum.com/member.php...o&userid=33407
View this thread: http://www.excelforum.com/showthread...hreadid=532285


  #3   Report Post  
Posted to microsoft.public.excel.misc
Therese
 
Posts: n/a
Default Split cell without breaking word?

Hi
One suggestion, you can doubleclick on the edge of the column to make it
automatically fitt, and then manually split the text.
You can also mark the sheet (ctrl+ A) and then format<cells< adjust and then
"split text". Sorry, danish...don't know what it says in the english verson.
If it's only one cell don't mark the whole sheet but format<cells< etc.
Hope it's what you meant.
THANKS
--
Therese


"Doug Benjamin" skrev:


What I want to do is split up a cell of about 25-60 characters into two
cells without ending up with words cut in half or duplicated words. I
want the first 30 characters in the first cell and the rest if any in
the second cell. Any Ideas?


--
Doug Benjamin
------------------------------------------------------------------------
Doug Benjamin's Profile: http://www.excelforum.com/member.php...o&userid=33407
View this thread: http://www.excelforum.com/showthread...hreadid=532285


  #4   Report Post  
Posted to microsoft.public.excel.misc
Therese
 
Posts: n/a
Default Split cell without breaking word?

UUuhh...sorry about the Thanks-caps. Ooops!!!:0)
--
Therese


"Doug Benjamin" skrev:


What I want to do is split up a cell of about 25-60 characters into two
cells without ending up with words cut in half or duplicated words. I
want the first 30 characters in the first cell and the rest if any in
the second cell. Any Ideas?


--
Doug Benjamin
------------------------------------------------------------------------
Doug Benjamin's Profile: http://www.excelforum.com/member.php...o&userid=33407
View this thread: http://www.excelforum.com/showthread...hreadid=532285


  #5   Report Post  
Posted to microsoft.public.excel.misc
Doug Benjamin
 
Posts: n/a
Default Split cell without breaking word?


Toppers:
How do I execute that fomulation? I am using Excel 2000. Will I need
2003 to do that?

Thanks...Doug


--
Doug Benjamin
------------------------------------------------------------------------
Doug Benjamin's Profile: http://www.excelforum.com/member.php...o&userid=33407
View this thread: http://www.excelforum.com/showthread...hreadid=532285



  #6   Report Post  
Posted to microsoft.public.excel.misc
Toppers
 
Posts: n/a
Default Split cell without breaking word?

This is VBA (Visual Basic for Applications) code.

As you are not familar with this you may need to do some research - I was
assuming some knowledge when I replied. Some addiional code will be required
as I expect you have many cells to convert.

To save time, send me your w/book anf I'll incorporate the code
)

HTH


Sub A
Dim v As Variant
Dim str1 As String, str2 As String
Dim fstr As Boolean
v = Split(Textstring," ")
str1 = ""
str2 = ""
fstr = True
For i = LBound(v) To UBound(v)
If Len(str1) + Len(v(i)) 30 Then fstr = False
If fstr Then
str1 = str1 + v(i) + " "
Else
str2 = str2 + v(i) + " "
End If
Next i
MsgBox str1 & " / " & str2
End sub

"Doug Benjamin" wrote:


Toppers:
How do I execute that fomulation? I am using Excel 2000. Will I need
2003 to do that?

Thanks...Doug


--
Doug Benjamin
------------------------------------------------------------------------
Doug Benjamin's Profile: http://www.excelforum.com/member.php...o&userid=33407
View this thread: http://www.excelforum.com/showthread...hreadid=532285


  #7   Report Post  
Posted to microsoft.public.excel.misc
Therese
 
Posts: n/a
Default Split cell without breaking word?

Hi
If it's too complicated, there is a formula that can do it. What caracters
are they?
--
Therese


"Doug Benjamin" skrev:


What I want to do is split up a cell of about 25-60 characters into two
cells without ending up with words cut in half or duplicated words. I
want the first 30 characters in the first cell and the rest if any in
the second cell. Any Ideas?


--
Doug Benjamin
------------------------------------------------------------------------
Doug Benjamin's Profile: http://www.excelforum.com/member.php...o&userid=33407
View this thread: http://www.excelforum.com/showthread...hreadid=532285


  #8   Report Post  
Posted to microsoft.public.excel.misc
JMB
 
Posts: n/a
Default Split cell without breaking word?

Another suggestion. Assuming your string is in cell A1, enter this in B1 to
get the first 30 characters (without splitting whole words - this must be
entered as an array formula which means it must be confirmed
w/Control+Shift+Enter):

IF(LEN(A1)<=30,A1,LEFT(A1,MATCH(30,IF((MID(A1,ROW( INDIRECT("1:"&LEN(A1))),1)=" "), (ROW(INDIRECT("1:"&LEN(A1)))),""),1)))

Then enter this in C1 to return the rest of the string:
=RIGHT(A1,LEN(A1)-LEN(B1))


"Doug Benjamin" wrote:


What I want to do is split up a cell of about 25-60 characters into two
cells without ending up with words cut in half or duplicated words. I
want the first 30 characters in the first cell and the rest if any in
the second cell. Any Ideas?


--
Doug Benjamin
------------------------------------------------------------------------
Doug Benjamin's Profile: http://www.excelforum.com/member.php...o&userid=33407
View this thread: http://www.excelforum.com/showthread...hreadid=532285


  #9   Report Post  
Posted to microsoft.public.excel.misc
JMB
 
Posts: n/a
Default Split cell without breaking word?

One other suggestion if you don't want any leading/trailing spaces in the
split data

Array Entered (and changed slightly due to nesting limits):
=TRIM(IF(LEN(A1)<=30,A1,LEFT(A1,LARGE((MID(A1,ROW( INDIRECT("1:"&LEN(A1))),1)=" ")* (ROW(INDIRECT("1:"&LEN(A1)))<=30)*(ROW(INDIRECT("1 :"&LEN(A1)))),1))))

Entered Normally:
=TRIM(RIGHT(A1,LEN(A1)-LEN(B1)))

"Doug Benjamin" wrote:


What I want to do is split up a cell of about 25-60 characters into two
cells without ending up with words cut in half or duplicated words. I
want the first 30 characters in the first cell and the rest if any in
the second cell. Any Ideas?


--
Doug Benjamin
------------------------------------------------------------------------
Doug Benjamin's Profile: http://www.excelforum.com/member.php...o&userid=33407
View this thread: http://www.excelforum.com/showthread...hreadid=532285


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
Deferring conditional formatting? Pheasant Plucker® Excel Discussion (Misc queries) 14 March 17th 06 08:17 PM
Why am I getting XXX error in text cell with word wrap turned on? HMF Excel Discussion (Misc queries) 2 March 16th 06 12:44 AM
Split cell as we do in table in word PK Baranwal New Users to Excel 2 March 9th 06 06:55 AM
Urgent date/scheduling calc needed jct Excel Worksheet Functions 3 February 24th 06 01:36 AM
how do I make a word typed in a cell go to a specific cell in anot Lmatarazzo Excel Discussion (Misc queries) 3 April 21st 05 04:29 AM


All times are GMT +1. The time now is 07:48 AM.

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"