Title: How to remove blank spaces in Excel - leading, trailing, non-breaking
Headings: How to remove spaces in Excel - leading, trailing, non-breaking
How to remove spaces in Excel - leading, trailing, non-breaking
How to remove blank spaces in Excel - leading, trailing, between words
=TRIM (A2)
How to delete line breaks and nonprinting characters
=TRIM (CLEAN (A2))
How to remove non-breaking spaces in Excel
=TRIM (SUBSTITUTE (A2, CHAR (160), " "))
=TRIM (CLEAN ( (SUBSTITUTE (A2,CHAR (160)," "))))
How to delete a specific non-printing character
=TRIM (SUBSTITUTE (SUBSTITUTE (A2, CHAR (127), " "), CHAR (160), " ")))
How to remove all spaces in Excel
=SUBSTITUTE (A2, CHAR (32), "")
=SUBSTITUTE (A2," ","")
How to count spaces in Excel
=LEN (A2)-LEN (SUBSTITUTE (A2," ",""))
=LEN (A2)-LEN (TRIM (A2))
Formula-free way to remove spaces and clean data
You may also be interested in

Content: Assuming the data to be cleaned is in cell A2, the formula is as follows: =TRIM (CLEAN (A2))
If the Trim/Clean formula joins the contents of multiple lines without spaces, you can fix it by using one of these techniques: Utilize the "Replace All" feature of Excel: in the "Find what" box, input a carriage return by pressing the Ctrl+J shortcut; and in the "Replace with" box, type a space. Clicking the Replace All button will swap all line breaks in the selected range for spaces. Use the following formula to substitute Carriage Return (value 13) and Line Feed (value 10) characters with spaces: =SUBSTITUTE (SUBSTITUTE (A2, CHAR (13)," "), CHAR (10), " ")
For more information, please see How to remove carriage returns (line breaks) in Excel. How to remove non-breaking spaces in Excel
If after using the TRIM & CLEAN formula some stubborn spaces are still there, most likely you copy/pasted the data from somewhere and a few non-breaking spaces sneaked in. To get rid of nonbreaking spaces (html character  ), replace them with regular spaces, and then have the TRIM function remove them: