trying to replace 2 spaces with 1

  • Thread starter Thread starter mgm
  • Start date Start date
M

mgm

Is there a way to search and replace within a column where there are 2
spaces present? When I search for " " (no quotes) it says cannot be found.

Thanks!
mgm
 
It works ok for me.

A1 = try<space><space>this
A2 = lets try this
A3 = try it

Select A1:A3
Goto Edit>Replace
Find what: hit the space bar twice
Replace with: hit the space bar once
Replace all

Results:

A1 = try this
A2 = lets try this
A3 = try it

Biff
 
Maybe someone else can respond with the technical explanation ("ansi
characters . . .") of why this works, but here's my approach:

- In some unused cell, type two spaces
- Highlight what you just typed and press Ctrl-C to copy
- Open the Replace function and paste (Ctrl-V) into the "Find What" field
- Paste again into the "Replace With" field, then hit backspace to eliminate
one of the two spaces.

If you want to limit your Replace to just one column, highlight that column
before invoking the Replace function.

HTH
 
You may have Non-Breaking Spaces in the cell. You can check with the Code() function
Look here for code to remove them:

http://www.mvps.org/dmcritchie/excel/join.htm#trimall

--
Kind regards,

Niek Otten
Microsoft MVP - Excel


| Is there a way to search and replace within a column where there are 2
| spaces present? When I search for " " (no quotes) it says cannot be found.
|
| Thanks!
| mgm
|
|
 
BTW, the TRIM() function reduces multiple spaces to single ones (and removes leading and trailing spaces)

--
Kind regards,

Niek Otten
Microsoft MVP - Excel


| You may have Non-Breaking Spaces in the cell. You can check with the Code() function
| Look here for code to remove them:
|
| http://www.mvps.org/dmcritchie/excel/join.htm#trimall
|
| --
| Kind regards,
|
| Niek Otten
| Microsoft MVP - Excel
|
|
|| Is there a way to search and replace within a column where there are 2
|| spaces present? When I search for " " (no quotes) it says cannot be found.
||
|| Thanks!
|| mgm
||
||
|
|
 
Another thing to look for -- make sure you don't have the checkbox "Match
Entire Cell Contents" selected! It could have been selected from a previous
Find/Replace.
Bob Umlas
Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top