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

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Copy one of these spaces (just the space) and paste it into a spare cell (say H1). What does this return

=CODE(H1)
 
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,217,750
Messages
6,138,407
Members
450,134
Latest member
TYoung24

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
Back
Top