+ Reply to Thread
Results 1 to 10 of 10

Break text string up into sub strings of 50 characters

  1. #1
    Registered User
    Join Date
    06-10-2015
    Location
    Sarasota, FL
    MS-Off Ver
    Excel 2007
    Posts
    7

    Break text string up into sub strings of 50 characters

    Hi, pretty new to formulas in excel but have a problem to solve....

    I need to turn one text string into 5 substrings with a maximum of 50 characters each (250 charaters in all). However, words need to remain intact and cannot be broken in the middle. Each substring will continue in the next column.

    I found this formula =MID($A1,1+(COLUMNS($A:A)-1)*49,49)&IF(COLUMNS($A:A)<=INT(LEN($A1)/49),",","") on this post
    [URL="http://www.excelforum.com/excel-general/919489-add-a-comma-after-every-49-characters.html"]

    It works except that it places commas in the middle of words. In my google search I came across many macro codes to complete tasks like this but when I copied the code and tried to run it nothing happened. Is it possible to run a macro on a just a cell selection or does it run on the entire sheet? If they can only run on an entire sheet then macros will not work.

    I do not need commas to break up the string but if they are needed in order to do so that is not a problem.

    If you can help it is INCREDIBLY APPRECIATED!

    Thank you,
    Michael

  2. #2
    Registered User
    Join Date
    08-17-2012
    Location
    New York, New York
    MS-Off Ver
    Excel 2010
    Posts
    97

    Re: Break text string up into sub strings of 50 characters

    How does the attached work for you? Formulas are in the yellow cells
    Attached Files Attached Files

  3. #3
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Break text string up into sub strings of 50 characters

    That breaks up words..

    Try like this (formulas in column B are array entered with CTRL + SHIFT + ENTER)

    EFsubstringsof50.xlsx

  4. #4
    Registered User
    Join Date
    06-10-2015
    Location
    Sarasota, FL
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Break text string up into sub strings of 50 characters

    Thank you both for your answers and sorry for the very late response! The array formula works excellent! Why does it have to be an array formula and not
    a regular one?

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2502
    Posts
    13,700

    Re: Break text string up into sub strings of 50 characters

    @ Jonmo1

    Good one ... FWIW ... and taking absolutely nothing away from your brilliant solution ... there are two non-breaking spaces in the string that "dodged the bullet" this time.
    Dave

  6. #6
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Break text string up into sub strings of 50 characters

    Please see attached file with non-array regular formula.
    Attached Files Attached Files
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2502
    Posts
    13,700

    Re: Break text string up into sub strings of 50 characters

    @AlKey
    And simple!

  8. #8
    Registered User
    Join Date
    06-10-2015
    Location
    Sarasota, FL
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Break text string up into sub strings of 50 characters

    Thats awesome thanks guys! One more formula needed, how would I add a comma every 50 characters but not in the middle of a text string with a maximum of 5 commas?

  9. #9
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Break text string up into sub strings of 50 characters

    Quote Originally Posted by Michaelsgoldman View Post
    Thats awesome thanks guys! One more formula needed, how would I add a comma every 50 characters but not in the middle of a text string with a maximum of 5 commas?
    This will mess up character count.

  10. #10
    Registered User
    Join Date
    06-10-2015
    Location
    Sarasota, FL
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Break text string up into sub strings of 50 characters

    It's a new formula, separate from the first one. Doesn't have to divide string into separate cells, just add the commas.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 06-07-2015, 08:43 AM
  2. [SOLVED] characters in text strings
    By jmilliken in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-25-2014, 01:44 PM
  3. Pass text strings longer than 255 characters
    By carry in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-22-2011, 12:26 PM
  4. Identifying Characters in Text Strings
    By Buzzpipaluk in forum Excel General
    Replies: 3
    Last Post: 03-22-2010, 09:50 AM
  5. Inserting same characters to text strings in several cell
    By 10036760 in forum Excel - New Users/Basics
    Replies: 6
    Last Post: 10-02-2007, 07:27 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1