Remove spaces after characters in Excel cells

  1. Among the characters whose code value (obtained by the CODE function) is in the range of 1-255, there are 148 invisible characters from 1-15, 28-32, 127-254.

  2. Among them, the characters whose code value is less than or equal to 31 (including 16-27 visible characters) and the characters whose code value is equal to 128 can be cleared by the CLEAN(A1) function.

  3. The invisible characters whose code value is equal to 32 and 129-254 can be cleared by the SUBSTITUTE(A1,CHAR(32),"") function. If such characters are at both ends of the string, the TRIM function can be used to clear them.

  4. Invisible characters whose code value is equal to 127 can only be cleared by the SUBSTITUTE(A1,CHAR(127),"") function.

  5. Using two functions at the same time can basically clear all invisible characters with a code value of less than 255 (including visible characters with a code value of 16-27):
    SUBSTITUTE(SUBSTITUTE(CLEAN(A1),CHAR(32),""), CHAR(127),"")

Guess you like

Origin blog.csdn.net/badxcat/article/details/114239176