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.
CodePudding user response:
try:
=TRIM(SUBSTITUTE(A1; CHAR(10); ))
for array:
=INDEX(TRIM(SUBSTITUTE(A1:A10; CHAR(10); )))
CodePudding user response:
You could use RegexReplace like so:
=REGEXREPLACE(D3,"\n","")
CodePudding user response:
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
As stated, the TRIM
function
Removes leading, trailing and repeated spaces in text.