Removing Spaces In Cell

Ethanflux

New Member
Joined
May 3, 2013
Messages
11
I have some information provided to me in cells and for some reason they provide names with like 9 or 10 spaces afterwards. How can I select that column and remove those spaces?
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Ctrl+H (Find and Replace) space with nothing
 
Upvote 0
If you have no spaces in the cells that you wish to keep (eg between fore and surname) then you could do a Find/Replace on the entire column:

1. Select column
2. Use Ctrl+h to open up Find/Replace dialog
3. In Find box type a space, leave Replace box blank
4. Under options, make sure "Match entire cell contents" is unchecked
5. Hit Replace All

An alternative formula approach might be in adjacent cells to use TRIM:

=TRIM(A1)

and copy down. You could then do a copy/pastespecial>values over your originals

Last alternative I will mention is to select the column, open up the VBE with Alt+F11 and open up the Immediate Window with Ctrl+g and then type (or copy) in the following and place all on one line and press Enter at the end of the line:

Code:
For Each c In Selection:c.Value = Application.Trim(c.Value):Next
 
Upvote 0

Forum statistics

Threads
1,215,036
Messages
6,122,794
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top