Useful Excel Tips in Triming
Useful Excel Tips in Triming
The example may be easier to understand if you copy it to a blank worksheet. How to copy an example
A
Data BD 122 ="XY"&CHAR(7)&"453"
1 2 3
BD
122
MN987 Formula =TRIM(A2) Description (Result) Removes the trailing space from the string "BD 122 " (BD 112) Removes the nonprinting BEL character (ASCII value of 7) from the string value created by the expression ="XY"&CHAR(7)&"453" (XY453)
4
=CLEAN(A3)
=TRIM(SUBSTITUTE(A4,CHAR(160),CHAR(32))) Replaces each nonbreaking space character (Unicode value of 160) with a space character (ASCII value of 32) by using the SUBSTITUTE function, and then removes the leading and multiple embedded spaces from the string " BD 122" (BD 112) =CLEAN(SUBSTITUTE(A5,CHAR(127),CHAR(7))) Replaces the nonprinting DEL character (ASCII value of 127) with a BEL character (ASCII value of 7) by using the SUBSTITUTE function, and then removes the BEL character from the string "MN987" (MN987)