+ Reply to Thread
Results 1 to 7 of 7

Remove leading and trailing line breaks

  1. #1
    Registered User
    Join Date
    06-02-2015
    Location
    Cali
    MS-Off Ver
    2010
    Posts
    27

    Cool Remove leading and trailing line breaks

    Hey guys hope someone can help me out on this one.

    I need a formula to remove leading and trailing line breaks. I would like to keep line breaks within the rest of the text though. There’s huge gaps in the beginning and end of each cell that I need to remove before exporting my work.

    Any help or other suggestions would be greatly appreciated thank you.

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,481

    Re: Remove leading and trailing line breaks

    could you give a sample?
    Quang PT

  3. #3
    Registered User
    Join Date
    06-02-2015
    Location
    Cali
    MS-Off Ver
    2010
    Posts
    27

    Re: Remove leading and trailing line breaks

    I have attached an example. It can be seen in column B. Thank you for your time.
    Attached Files Attached Files

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,481

    Re: Remove leading and trailing line breaks

    In B3 (or any available cell)
    Please Login or Register  to view this content.
    Copy/paste value back to B2

  5. #5
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,418

    Re: Remove leading and trailing line breaks

    @bebo021999 - I think your formula gets tripped up on the multiple internal line feeds within the text.

    @erikpaulsen - I think this array-entered** formula will work but note that because of the size of the text and number of lines within it, all of the text is not able to be visible in the cell (it's there, you just can't see it).

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    **Commit this formula using CTRL+SHIFT+ENTER and not just Enter by itself.

    NOTE: You have a single space character mixed in with your leading Line Feeds... it must be removed in order for my formula to work correctly (one of the things my formula does is look for the first non-Line Feed character).

  6. #6
    Registered User
    Join Date
    06-02-2015
    Location
    Cali
    MS-Off Ver
    2010
    Posts
    27

    Re: Remove leading and trailing line breaks

    @Rick Rothstein - Your formula worked great. Is there a way to reduce the multiple line breaks found within the cells to a single line break? The data scrape was messy and huge gaps can be found within the data.

    Thank you for your help.

  7. #7
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,418

    Re: Remove leading and trailing line breaks

    Ah, collapsing multiple line feeds down to single line feeds make the formula simpler. Give this a try...
    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ 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. [SOLVED] How to remove leading AND trailing zeros.
    By isychos in forum Excel General
    Replies: 14
    Last Post: 10-12-2018, 06:51 PM
  2. [SOLVED] Remove leading zeroes and trailing space
    By kersplash in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 12-12-2017, 12:33 AM
  3. [SOLVED] How to remove all leading and trailing colons (;) from a text?
    By excelhelp2045 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-28-2015, 01:19 AM
  4. Remove leading and trailing spaces in each new line break in cell
    By halo12 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-29-2015, 07:10 AM
  5. [SOLVED] Remove leading and trailing spaces in a cell?
    By LF_CC in forum Excel General
    Replies: 4
    Last Post: 12-05-2013, 03:12 PM
  6. Remove leading, trailing & non-breaking spaces on a worksheet
    By Kennethc in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-06-2013, 07:03 PM
  7. Remove Certain Line Breaks in cell
    By hollyc2424 in forum Excel General
    Replies: 1
    Last Post: 05-18-2011, 01:47 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