trimming cells

rlocher

New Member
Joined
Oct 4, 2007
Messages
15
ok, there is probably an easy solution here, but I can't figure it out. I need to remove the trailing "spaces" in some cells but I don't think they're really spaces. TRIM or CLEAN doesn't work. I tried LEN(SUBSTITUTE(A1," ","")) to count the number of characters without spaces and it's counting something other than text. Text to columns (space or tab delimited) doesn't work - it separates by spaces between words, but not the ones after. I still have blank space after the text. First question, if they're not spaces, what are they? Secondly, how do I trim the unwanted junk after the text? Of note, these are city/town names so spaces need to be kept between words - just not after. Any ideas?
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Copy one of these spaces (just the space) and paste it into a spare cell (say H1). What does this return

=CODE(H1)
 

rlocher

New Member
Joined
Oct 4, 2007
Messages
15

ADVERTISEMENT

I get #VALUE!
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Hmm. You would get that if H1 was blank. Maybe you didn't manage to copy the space (it can be tricky).

In H1 enter

=RIGHT(A1,1)

where A1 has text with a trailing space. What does the CODE formula return now.
 

rlocher

New Member
Joined
Oct 4, 2007
Messages
15

ADVERTISEMENT

I think you were right.

Now I'm getting 32
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Curiouser and curiouser.

Code 32 is a regular space so I don't understand why none of the methods that you've tried have worked.

Edit

Can you try

=LEFT(A1,LEN(A1)-1)

Does that remove the space.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,699
Messages
5,833,201
Members
430,196
Latest member
rez5656

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
Top