Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 84
Default Finding (and eliminating) hidden "space" character

I downloaded some numeric data but I have discovered that there is a leading
"space" character. I tried a find and replace and a host of other tricks but
short of going into each cell and deleting I'm at a loss for how to bulk find
and replace this. It's preventing me from sorting, etc. I tried to outfox
it by doing a formula and adding the value to "0" but I got an error and when
I asked it to evaluate it gave me the following:( =" 1069.95"+0) and that's
how I discovered the leading space.

Thanks -

mm
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Finding (and eliminating) hidden "space" character

Here is a macro I use to replace/remove:
1) many many spaces = one
2) Probably your culprit he the Unicode "character 160" = a normal space.
3) a space & period = just a period .<=corrects this anomoly.
4) and some other annoyances...see below.

Sub TrimNSlenderizeNCleanAll()
Application.ScreenUpdating = False
Application.EnableEvents = False
On Error Resume Next
Dim cell As Range
For Each cell In Selection.Cells
If cell.HasFormula = False Then
cell.Replace What:=" ,", Replacement:=", ", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
cell.Replace What:=Chr(160), Replacement:=Chr(32), _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
cell.Replace What:=" .", Replacement:=". ", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
cell = Trim(cell)
cell.Value = Application.Clean(cell.Value)
cell.Replace What:=" ", Replacement:=" ", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
cell.Replace What:=" ", Replacement:=" ", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
cell.Replace What:=" ", Replacement:=" ", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
cell.Replace What:=" ", Replacement:=" ", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
cell.Replace What:=" ", Replacement:=" ", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
cell.Replace What:=" ", Replacement:=" ", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
End If
Next cell
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub

It has taken me maybe a few days to figure that one out manually (i.e.
learning Visual Basic through examples); enjoy!

"smartgal" wrote:

I downloaded some numeric data but I have discovered that there is a leading
"space" character. I tried a find and replace and a host of other tricks but
short of going into each cell and deleting I'm at a loss for how to bulk find
and replace this. It's preventing me from sorting, etc. I tried to outfox
it by doing a formula and adding the value to "0" but I got an error and when
I asked it to evaluate it gave me the following:( =" 1069.95"+0) and that's
how I discovered the leading space.

Thanks -

mm

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Finding (and eliminating) hidden "space" character

hi
usually(at least up to 2003) excel strips away leading spaces the same way
it strips away leading zeros, viewing such characters as unnecessary so i
suppect that your data was imported as text or at least excel is seeing it as
text.
try this.
put a 1 in a cell off to the side. copy it. highlight your data then paste
special multiply.

regards
FSt1

"smartgal" wrote:

I downloaded some numeric data but I have discovered that there is a leading
"space" character. I tried a find and replace and a host of other tricks but
short of going into each cell and deleting I'm at a loss for how to bulk find
and replace this. It's preventing me from sorting, etc. I tried to outfox
it by doing a formula and adding the value to "0" but I got an error and when
I asked it to evaluate it gave me the following:( =" 1069.95"+0) and that's
how I discovered the leading space.

Thanks -

mm

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,344
Default Finding (and eliminating) hidden "space" character

Hi,

If it is constistently a single character - select the column of data and
choose Data, Text to Columns, pick Fixed width, click Next, click between the
1st and 2nd characters in the Preview area and click Finish. Or click Next
and change the destination cell.
--
Thanks,
Shane Devenshire


"smartgal" wrote:

I downloaded some numeric data but I have discovered that there is a leading
"space" character. I tried a find and replace and a host of other tricks but
short of going into each cell and deleting I'm at a loss for how to bulk find
and replace this. It's preventing me from sorting, etc. I tried to outfox
it by doing a formula and adding the value to "0" but I got an error and when
I asked it to evaluate it gave me the following:( =" 1069.95"+0) and that's
how I discovered the leading space.

Thanks -

mm

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 168
Default Finding (and eliminating) hidden "space" character

Hi mm,

Sounds like non-breaking spaces. To get rid of them
select all of your data
Go to EditReplace
Find What: Alt+0160
Replace With: Leave this box blank
Click Replace All

Alt 0160 is entered by holding down Alt, type 0160
on the Number pad only then let go of Alt)


HTH
Martin

"smartgal" wrote in message
...
I downloaded some numeric data but I have discovered that there is a
leading
"space" character. I tried a find and replace and a host of other tricks
but
short of going into each cell and deleting I'm at a loss for how to bulk
find
and replace this. It's preventing me from sorting, etc. I tried to
outfox
it by doing a formula and adding the value to "0" but I got an error and
when
I asked it to evaluate it gave me the following:( =" 1069.95"+0) and
that's
how I discovered the leading space.

Thanks -

mm





  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 84
Default Finding (and eliminating) hidden "space" character

*Perfect* !! Thanks!

"MartinW" wrote:

Hi mm,

Sounds like non-breaking spaces. To get rid of them
select all of your data
Go to EditReplace
Find What: Alt+0160
Replace With: Leave this box blank
Click Replace All

Alt 0160 is entered by holding down Alt, type 0160
on the Number pad only then let go of Alt)


HTH
Martin

"smartgal" wrote in message
...
I downloaded some numeric data but I have discovered that there is a
leading
"space" character. I tried a find and replace and a host of other tricks
but
short of going into each cell and deleting I'm at a loss for how to bulk
find
and replace this. It's preventing me from sorting, etc. I tried to
outfox
it by doing a formula and adding the value to "0" but I got an error and
when
I asked it to evaluate it gave me the following:( =" 1069.95"+0) and
that's
how I discovered the leading space.

Thanks -

mm




  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 168
Default Finding (and eliminating) hidden "space" character

You're welcome Smartgal, Thanks for posting back.

Regards
Martin


"smartgal" wrote in message
...
*Perfect* !! Thanks!

"MartinW" wrote:

Hi mm,

Sounds like non-breaking spaces. To get rid of them
select all of your data
Go to EditReplace
Find What: Alt+0160
Replace With: Leave this box blank
Click Replace All

Alt 0160 is entered by holding down Alt, type 0160
on the Number pad only then let go of Alt)


HTH
Martin

"smartgal" wrote in message
...
I downloaded some numeric data but I have discovered that there is a
leading
"space" character. I tried a find and replace and a host of other
tricks
but
short of going into each cell and deleting I'm at a loss for how to
bulk
find
and replace this. It's preventing me from sorting, etc. I tried to
outfox
it by doing a formula and adding the value to "0" but I got an error
and
when
I asked it to evaluate it gave me the following:( =" 1069.95"+0) and
that's
how I discovered the leading space.

Thanks -

mm






  #8   Report Post  
Posted to microsoft.public.excel.misc
m m is offline
external usenet poster
 
Posts: 64
Default Finding (and eliminating) hidden "space" character

MartinW another similar problem-
M here,

I have similar needs - sometimes the find 160 replace works but on one of my
spread sheets with (cell view shows) leading and trailing 160 characters -
nothing seems to work to extract or otherwise convert this to a "real" number
format - except once by some accident that I can't seem to repeat.
Any suggestions?
I am about to post it as a separate frustrating problem that I need help with.


Thank you,
M

"MartinW" wrote:

Hi mm,

Sounds like non-breaking spaces. To get rid of them
select all of your data
Go to EditReplace
Find What: Alt+0160
Replace With: Leave this box blank
Click Replace All

Alt 0160 is entered by holding down Alt, type 0160
on the Number pad only then let go of Alt)


HTH
Martin


  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 168
Default Finding (and eliminating) hidden "space" character

Hi M,

To tidy it up properly you may have to do find and replace
for a normal space as well as the 0160.

With that done copy a fresh blank cell (make sure it is one
that has never had anything in it.)

Then select all of your data, then EditPaste Special and check
the Add radio button and OK.

That will convert your text numbers to real numbers.

HTH
Martin

"M" wrote in message
...
MartinW another similar problem-
M here,

I have similar needs - sometimes the find 160 replace works but on one of
my
spread sheets with (cell view shows) leading and trailing 160 characters -
nothing seems to work to extract or otherwise convert this to a "real"
number
format - except once by some accident that I can't seem to repeat.
Any suggestions?
I am about to post it as a separate frustrating problem that I need help
with.


Thank you,
M

"MartinW" wrote:

Hi mm,

Sounds like non-breaking spaces. To get rid of them
select all of your data
Go to EditReplace
Find What: Alt+0160
Replace With: Leave this box blank
Click Replace All

Alt 0160 is entered by holding down Alt, type 0160
on the Number pad only then let go of Alt)


HTH
Martin




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help removing "space" character (question updated) smartgal Excel Discussion (Misc queries) 5 June 30th 08 08:21 PM
Help removing "space" character from imported data smartgal Excel Discussion (Misc queries) 3 June 30th 08 07:38 PM
Eliminating "tails" on line charts Skyscan Charts and Charting in Excel 2 June 13th 07 11:47 AM
how do I type "itis" without Excel putting a space "it is"? Max Excel Worksheet Functions 4 March 18th 07 10:22 PM
finding "™‚" character in a worksheet davids Excel Discussion (Misc queries) 2 March 22nd 06 12:17 PM


All times are GMT +1. The time now is 11:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"