Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Karidre
 
Posts: n/a
Default Remove leading space

I wonder if someone can help me with this...it's driving me crazy.

I need to delete a leading space from multiple cells, 200 or more. The
leading space is in front of text that is often more than one word so I can't
just copy into Word and do a find and replace on the spaces.

I looked in many places for help and found out about the Trim function but
when I tried it, it didn't work for me. Am I doing it wrong? I created a
column next to the column that I want to remove the leading spaces from. then
I put =TRIM(B2) in the first cell, =TRIM (B3) in the next one, etc. But all
it did was put the exact same thing as before (with the leading space still
in it) in that column?

Any suggestions? Thanks!

- Kari
  #2   Report Post  
JMB
 
Posts: n/a
Default Remove leading space

The trim function should have worked if it was just a space entered w/the
spacebar.

It could be a special character that appears as a space. Try
Search/Replace. In the search line, hold down the Alt key and hit 255 on the
number keypad. Then hit Replace All.

Be sure to back up your workbook.




"Karidre" wrote:

I wonder if someone can help me with this...it's driving me crazy.

I need to delete a leading space from multiple cells, 200 or more. The
leading space is in front of text that is often more than one word so I can't
just copy into Word and do a find and replace on the spaces.

I looked in many places for help and found out about the Trim function but
when I tried it, it didn't work for me. Am I doing it wrong? I created a
column next to the column that I want to remove the leading spaces from. then
I put =TRIM(B2) in the first cell, =TRIM (B3) in the next one, etc. But all
it did was put the exact same thing as before (with the leading space still
in it) in that column?

Any suggestions? Thanks!

- Kari

  #3   Report Post  
Biff
 
Posts: n/a
Default Remove leading space

Hi!

Maybe those leading spaces aren't your standard leading spaces, char 32!
They may be some other unseen character like the dreaded char 160.

Try finding out what the actual characters are. Use this formula in a
temporary helper column:

=CODE(B2)

Once you know what those characters are then they should be fairly easy to
get rid of using either EditReplace or, maybe a formula like:

=MID(B2,2,255)

Or:

=SUBSTITUTE(B2,LEFT(B2),"")

Then you could convert the formulas to constants by doing a CopyPaste
SpecialValues. Then deleting the original data.

Biff

"Karidre" wrote in message
...
I wonder if someone can help me with this...it's driving me crazy.

I need to delete a leading space from multiple cells, 200 or more. The
leading space is in front of text that is often more than one word so I
can't
just copy into Word and do a find and replace on the spaces.

I looked in many places for help and found out about the Trim function but
when I tried it, it didn't work for me. Am I doing it wrong? I created a
column next to the column that I want to remove the leading spaces from.
then
I put =TRIM(B2) in the first cell, =TRIM (B3) in the next one, etc. But
all
it did was put the exact same thing as before (with the leading space
still
in it) in that column?

Any suggestions? Thanks!

- Kari



  #5   Report Post  
Dave Peterson
 
Posts: n/a
Default Remove leading space

If you're getting this data from a web page, you may have non-breaking spaces
(HTML stuff) in those cells.

You may want to try David McRitchie's routine to clean that stuff up:

http://www.mvps.org/dmcritchie/excel/join.htm#trimall
(look for "Sub Trimall()")

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

=========
If you want to try a formula, this may work:

=trim(substitute(a1,char(160)," "))

It changes the non-Breaking character to a space, then trims the value.

Excel also has =clean() that you may want to review, too.

Karidre wrote:

I wonder if someone can help me with this...it's driving me crazy.

I need to delete a leading space from multiple cells, 200 or more. The
leading space is in front of text that is often more than one word so I can't
just copy into Word and do a find and replace on the spaces.

I looked in many places for help and found out about the Trim function but
when I tried it, it didn't work for me. Am I doing it wrong? I created a
column next to the column that I want to remove the leading spaces from. then
I put =TRIM(B2) in the first cell, =TRIM (B3) in the next one, etc. But all
it did was put the exact same thing as before (with the leading space still
in it) in that column?

Any suggestions? Thanks!

- Kari


--

Dave Peterson
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
How do I remove the leading 1 from a nine digit telephone # pc Excel Discussion (Misc queries) 3 May 12th 23 03:42 AM
How do I remove leading apostrophes in Excel? Nino Excel Discussion (Misc queries) 8 December 13th 05 12:14 PM
Remove text leading zero in text string Cheryl B. Excel Worksheet Functions 5 May 29th 05 07:46 PM
Remove text leading zero in text string Peo Sjoblom Excel Worksheet Functions 0 May 27th 05 09:59 PM
Remove leading Numbers from text DBLWizard Excel Worksheet Functions 2 March 31st 05 11:08 PM


All times are GMT +1. The time now is 11:55 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"