TRIM Help !

  • Thread starter Thread starter Nikki
  • Start date Start date
N

Nikki

I have a column that has a name "Nikki" followed by 13 spaces. When I
concatenate the first name with the last, I have 13 spaces between the two
names. Is there a formula that will give me only the letters in the name and
remove the spaces?

Thanks for your help.

Nikki
 
Just to ADD on

=LTRIM(" A ") or Left Trim will result in "A "
=RTRIM(" A ") or Right Trim will result in " A"
TRIM will do the trimming from both sides

If this post helps click Yes
 
Both ltrim and rtrim will work in code, but they're not functions built into
excel.

Maybe you have built your own UDF's to do this???
 
And, just to add. I find that the code trims don't always work well so I
tend to use

application.trim(range("a1")) in my coding.
 
And just to add (squared, vbg):

the worksheet function application.trim() and VBA's trim function do different
things.

application.trim(" this is a test ")
would return
this is a test
(a single space between each word and leading/trailing spaces gone)


VBA's trim:
trim(" this is a test ")
would return
this is a test
(removing the leading/trailing spaces, but keeping multiple internal spaces)
 
Works for me with regular spaces.

Perhaps the spaces are html non-breaking spaces which TRIM will not handle.

Suggest selecting the cells and Edit>Replace

What: Alt + 0160(on the numpad)

With: nothing

Replace all.


Gord Dibben MS Excel MVP
 
In which case they are presumably *not* spaces.
What does =CODE(MID(A3,6,1)) give you? It would be 32 if the characters
were spaces. 160 is a non-breaking space, which TRIM doesn't remove, but
see the other advice you've received in this thread.
 
Back
Top