+ Reply to Thread
Results 1 to 4 of 4

Break a line of text at specfied character count

  1. #1
    Registered User
    Join Date
    11-18-2011
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2016
    Posts
    31

    Break a line of text at specfied character count

    I have a file containing about 30k business names. In order to import this into another program the name must not exceed 35 characters. Can I break the name into two cells at the last space before the 35 character limit within the name is reached? For example:

    Column A: Cardiovascular Diseases & Interventional Cardiology
    Column B: Cardiovascular Diseases &
    Column C: Interventional Cardiology

  2. #2
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Break a line of text at specfied character count

    Try This in B1 - =LEFT(A1,FIND(" ",A1,25)-1) & in C1 - =RIGHT(A1,(LEN(A1)-1-LEN(B1)))

    It will work in most cases though!

    Deep
    Cheers!
    Deep Dave

  3. #3
    Registered User
    Join Date
    11-18-2011
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2016
    Posts
    31

    Re: Break a line of text at specfied character count

    That works for the business names which exceed character limit, but the shorter names (ABC Surgical Centers) produce an error.

  4. #4
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Break a line of text at specfied character count

    Here!

    In B1 - =IF(LEN(A1)>35,LEFT(A1,FIND(" ",A1,25)-1),A1)

    In C1 - =IFERROR(RIGHT(A1,(LEN(A1)-1-LEN(B1))),"")

    Deep

+ 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. Extract text prior to line break
    By Dulanic in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-30-2022, 01:20 PM
  2. Replies: 12
    Last Post: 06-22-2016, 01:11 PM
  3. Macro Add line break after character
    By Tybalt in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-01-2013, 09:08 PM
  4. break line in text cell from ASP
    By Lorenzo in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-06-2006, 09:10 AM
  5. Cells.Find for text w/ line break
    By achidsey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-14-2005, 01:05 AM

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