Remove leading or trailing spaces in an entire column of data

excel, excel-2010, excel-formula

Solution

If you would like to use a formula, the `TRIM` function will do exactly what you're looking for:

+----+------------+---------------------+
|    |     A      |           B         |
+----+------------+---------------------+
| 1  | =TRIM(B1)  |  value to trim here |
+----+------------+---------------------+

So to do the whole column... 1) Insert a column 2) Insert `TRIM` function pointed at cell you are trying to correct. 3) Copy formula down the page 4) Copy inserted column 5) Paste as "Values"

Should be good to go from there...

Problem

How do I remove leading or trailing spaces of all cells in an entire column? The worksheet's conventional `Find and Replace` (aka Ctrl+H) dialog is not solving the problem.

Original source