+ Reply to Thread
Results 1 to 4 of 4

How to remove first and last linebreaks in excel?

  1. #1
    Registered User
    Join Date
    05-19-2020
    Location
    India
    MS-Off Ver
    2016
    Posts
    2

    Smile How to remove first and last linebreaks in excel?

    Below are the input which is copy from excel column. There are some random number of linebreaks in first and last position.

    "

    Test 1
    Test 2
    Test 3
    "

    "
    Test 1
    Test 2
    Test 3

    "

    "
    Test 1
    Test 2
    Test 3
    "

    "

    Test 1
    Test 2
    Test 3

    "

    I need output as below:

    "Test 1
    Test 2
    Test 3"

    "Test 1
    Test 2
    Test 3"

    "Test 1
    Test 2
    Test 3"

    "Test 1
    Test 2
    Test 3"

    The above output removes all blanklines and linebreaks. Is it possible in excel or VBA?
    Attached Files Attached Files
    Last edited by hawkinsshirley; 05-19-2020 at 11:31 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,720

    Re: How to remove first and last linebreaks in excel?

    please read the yellow banner at the top of this page on how to attach a file. Cannot manipulate data that you have typed into the thread. Need to see the file.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: How to remove first and last linebreaks in excel?

    Okay, this is a brunt strength approach. There might be a better one utilizing FREQUENCY or some other function. My assumptions are
    1. There's never more than three line breaks in a row
    2. There are no double line breaks between text
    3. The text might contain blanks.
    Here's the formula for B2 copied down
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Registered User
    Join Date
    05-19-2020
    Location
    India
    MS-Off Ver
    2016
    Posts
    2

    Re: How to remove first and last linebreaks in excel?

    Dear ChemistB,
    I just tried to the same sheet (example.xlsx) but problem not solved, result showing as same as column A . Please find the attached image for output result. Please help me. Attachment 678635

+ 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. LineBreaks/CarriageReturns for VBA for Multiple SQL Commands
    By T86157 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-21-2015, 01:20 PM
  2. Rows to columns with linebreaks
    By loremipsum in forum Excel General
    Replies: 12
    Last Post: 05-26-2014, 06:37 PM
  3. Generate a text from 3 columns - with linebreaks
    By Wiid in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-16-2012, 12:48 PM
  4. Hyperlink Function: Mailto with Body containing linebreaks
    By Elipapa in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-12-2012, 04:36 PM
  5. [SOLVED] Removing linebreaks/whitespace? (Cleaning up my output)
    By CFJensen in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-08-2012, 06:21 PM
  6. Replies: 8
    Last Post: 06-06-2012, 11:09 AM
  7. How make linebreaks without turning on Word-wrap?
    By white-k in forum Excel General
    Replies: 5
    Last Post: 01-03-2008, 04:01 AM

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