google-sheetsexcel-formulagoogle-sheets-formula

Remove all excessive line breaks at end of cell


In google sheets i am using the function TRIM() to remove leading and trailing spaces in text, but I also want to remove line breaks at the end of each cell/text, basically excessive line breaks that were left there by mistake or w/e. Is there a way to go about this?

Posting picture that shows what I want. enter image description here


Solution

  • You mention:

    basically excessive line breaks

    Using TRIM removes trailing spaces AND trailing line breaks.

    It even removes both if they happen to coexist.

    On your example it is the height of neighbour cell that cause the result.

    Test your results in a different sheet.

    You can use a formula like:

    =INDEX(TRIM('Sheet 1'!A2:A9))
    

    Please take a look at an example of how TRIM works

    example of how TRIM works

    As stated, the TRIM function

    Removes leading, trailing and repeated spaces in text.


    Functions used:
    TRIM
    INDEX
    TRANSPOSE