删除单元格中的文本字符串后的空格 - excel

时间:2023-01-23 20:23:32

Ive pasted a large list of data into column A in a excel sheet, all the data has come in with a space after the text ie. 'text ', 'some more text '..

我已经将一大堆数据粘贴到Excel工作表的A列中,所有数据都在文本后面加了一个空格即。 'text','更多文字'..

I need to clear away this last space, as an approach i tried to find/replace all spaces, but that left me with a load of text strings like 'somemoretext' as it also deleted all the spaces in between words, any idea how i should handle this ?

我需要清除这最后一个空间,作为一种方法,我试图找到/替换所有空格,但这给我留下了一些文本字符串,如'somemoretext',因为它也删除了单词之间的所有空格,任何想法如何我应该处理这个?

3 个解决方案

#1


5  

TRIM In Microsoft Excel, the TRIM function returns a text value with the leading and trailing spaces removed.

TRIM在Microsoft Excel中,TRIM函数返回一个文本值,其中删除了前导和尾随空格。

Or you can still use Find and Replace option: Find "text " Replace "text".

或者您仍然可以使用“查找和替换”选项:查找“文本”替换“文本”。

#2


1  

You can use logical approach: check last character

您可以使用逻辑方法:检查最后一个字符

(right(cell;1))

=IF(RIGHT(A3;1)=" ";LEFT(A3;LEN(A3)-1);A3)

If an space exists at the end, it will return the string -1 character (the space) if there isn't a space, it will return the text without change

如果末尾存在空格,如果没有空格,它将返回字符串-1字符(空格),它将返回文本而不更改

#3


0  

You can also remove leading and trailing spaces from column name with this method.

您还可以使用此方法从列名称中删除前导和尾随空格。

Remove Leading and Trailing Whitespace from Excel Cells

从Excel单元格中删除前导和尾随空格

See my answer there.

看那里的答案。

#1


5  

TRIM In Microsoft Excel, the TRIM function returns a text value with the leading and trailing spaces removed.

TRIM在Microsoft Excel中,TRIM函数返回一个文本值,其中删除了前导和尾随空格。

Or you can still use Find and Replace option: Find "text " Replace "text".

或者您仍然可以使用“查找和替换”选项:查找“文本”替换“文本”。

#2


1  

You can use logical approach: check last character

您可以使用逻辑方法:检查最后一个字符

(right(cell;1))

=IF(RIGHT(A3;1)=" ";LEFT(A3;LEN(A3)-1);A3)

If an space exists at the end, it will return the string -1 character (the space) if there isn't a space, it will return the text without change

如果末尾存在空格,如果没有空格,它将返回字符串-1字符(空格),它将返回文本而不更改

#3


0  

You can also remove leading and trailing spaces from column name with this method.

您还可以使用此方法从列名称中删除前导和尾随空格。

Remove Leading and Trailing Whitespace from Excel Cells

从Excel单元格中删除前导和尾随空格

See my answer there.

看那里的答案。