Thursday, 12 April 2018

microsoft excel - How to remove white space from a number


I have a column of number with white spaces in them. Like this: "32 445 423". How do I get rid of all the white space to get excel to treat it as numbers rather than strings?


EDIT: Let me fill in some additional information that has come to light. My goal is to turn "32 445 423" into a 32445423. If I write in the string "32 445 423" into excel and use =SUBSTITUTE(A1;" ";"") it removes the spaces just fine. But the numbers I have are imported from a csv file. When running SUBSTITUTE on the imported numbers only leading and trailing spaces are removed.



Answer



I believe your imported data includes non-breaking spaces instead of standard spaces. Hence, the formula =SUBSTITUTE(A1," ","") does not work. Instead of using the space bar to type the " " in the SUBSTITUTE formula, try a non-breaking space. You can select this in the Character Map or use keystroke Alt+0160.


EDIT:


Since substituting regular spaces successfully removed the leading and trailing spaces, you should use nested Substitute formulas: one to sub the regular spaces and one to remove the no-break spaces.


=SUBSTITUTE(SUBSTITUTE(A1," ","")," ","")

You can copy this formula to try it in your workbook.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...