Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Pete
 
Posts: n/a
Default Strip leading spaces from cell

I need a formula to remove/delete leading spaces from a cell.

column b contains data imported from anothe application. unfortuantly some
of these cells have padded leading blanks added.

I need to remove these. but 3000+ cells individually will take hours.

any help?
  #2   Report Post  
KL
 
Posts: n/a
Default

Hi Pete,

Try this:

=TRIM(A1)

Regards,
KL


"Pete" wrote in message
...
I need a formula to remove/delete leading spaces from a cell.

column b contains data imported from anothe application. unfortuantly some
of these cells have padded leading blanks added.

I need to remove these. but 3000+ cells individually will take hours.

any help?



  #3   Report Post  
David McRitchie
 
Posts: n/a
Default

If they are from another application they may not be spaces,
they could be CHAR(160) which is a Required blank (RBL),
or in HTML is know as a nonbreaking space ( )

If you really only want to trim the leading space you would use
LTRIM in VBA but you probably want to trim both sides as previously
suggested.

I would recommend doing this with a macro so that you can change
things in place rather than the little dance routine of creating a helper
column, converting that column to constants and then removing the
original. If you enjoy doing the extra steps and it is CHAR(160)
you could look at my strings.htm page and use something like
=TRIM( SUBSTITUTE(A21, CHAR(160)," ") )
there is no LTRIM function in worksheet functions but there is in VBA

But for a macro to trim both sides and possible excessive spaces in between see
http://www.mvps.org/dmcritchie/excel/join.htm#trimall
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"KL" wrote in message ...
Hi Pete,

Try this:

=TRIM(A1)

Regards,
KL


"Pete" wrote in message
...
I need a formula to remove/delete leading spaces from a cell.

column b contains data imported from anothe application. unfortuantly some
of these cells have padded leading blanks added.

I need to remove these. but 3000+ cells individually will take hours.

any help?





  #4   Report Post  
CLR
 
Posts: n/a
Default

ASAP Utilities, a free add-in at www.asap-utilities.com includes this
capability among it's many nifty features.........

Vaya con Dios,
Chuck, CABGx3


"Pete" wrote in message
...
I need a formula to remove/delete leading spaces from a cell.

column b contains data imported from anothe application. unfortuantly some
of these cells have padded leading blanks added.

I need to remove these. but 3000+ cells individually will take hours.

any help?



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
Format a cell to keep leading zeros. Shadyhosta New Users to Excel 5 July 27th 05 04:37 PM
macro help thephoenix12 Excel Discussion (Misc queries) 4 July 15th 05 05:57 PM
up to 7 functions? ALex Excel Worksheet Functions 10 April 12th 05 06:42 PM
Syntax for inferred cell references donesquire Excel Worksheet Functions 4 April 4th 05 09:29 PM
VLookup resulting in a blank cell... KempensBoerke Excel Worksheet Functions 1 October 28th 04 09:57 PM


All times are GMT +1. The time now is 11:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"