TRIM not trimming

G

Guest

I have thousands of rows of data that I have used the "Text to Columns"
function on so that they are now two columns instead of one (text in A,
numbers in B).

However, there are leading and trailing spaces in both columns, and when I
used the =TRIM function to remove them, it doesn't work. Even when I use TRIM
in column D, then copy that value into Notepad, I can still see the spaces.

What's wrong?


-- Thanks,
-Kim
 
H

Harlan Grove

Kim said:
However, there are leading and trailing spaces in both columns, and
when I used the =TRIM function to remove them, it doesn't work. Even
when I use TRIM in column D, then copy that value into Notepad, I
can still see the spaces.
....

I'd guess your cell data comes from an HTML source, and it contains
nonbreaking spaces (decimal character code 160). You need to replace
them with ASCII/breaking spaces, then apply TRIM.

=TRIM(SUBSTITUTE(x,CHAR(160)," "))
 
G

Guest

if there are still apperant spaces you can use code(mid(...)) to identify the
code to use in the char() formula
 

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

Top