Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 389
Default Trim Leading Spaces

How do I trim the just the leading and trailing spaces in a cell?
For example

" Project - 1234 " becomes "Project - 1234"

Thank you for you help.

Steven
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Trim Leading Spaces

All in one column?

Select that column
Data|Text to columns
Fixed width
remove any lines that excel guessed

Finish up.

Steven wrote:

How do I trim the just the leading and trailing spaces in a cell?
For example

" Project - 1234 " becomes "Project - 1234"

Thank you for you help.

Steven


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,574
Default Trim Leading Spaces

=TRIM(A1) etc.

Dave
--
A hint to posters: Specific, detailed questions are more likely to be
answered than questions that provide no detail about your problem.


"Steven" wrote:

How do I trim the just the leading and trailing spaces in a cell?
For example

" Project - 1234 " becomes "Project - 1234"

Thank you for you help.

Steven

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,101
Default Trim Leading Spaces

Using trim leaves a space between the quotes and the first and last letter so
a bit more complicated but try

=CONCATENATE("""",TRIM(MID(A15,2,LEN(A15)-2)),"""")

where your string is in A15

"Steven" wrote:

How do I trim the just the leading and trailing spaces in a cell?
For example

" Project - 1234 " becomes "Project - 1234"

Thank you for you help.

Steven

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 389
Default Trim Leading Spaces

There are not actually quotes in the string. I just have them to show there
are spaces in front and back. Also, the number of spaces can vary. The
first record may have 3 spaces in front and the second 5 and so on.....

' This is record one '
' This is record two '
'This is record three '

There are not really ' in the cell. I just included them to show all the
blank spaces.

How using a formula would you take the leading and trailing spaces away?

Thank you,

Steven


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 389
Default Trim Leading Spaces

I forgot to mention:

If I just put an example in excel with spaces then the text then spaces and
test with Trim(CellAddress) then it will trim properly.

This was something taken off the internet. I have see in other posts where
you have to test the characters but I have not been able to make those work.
It is the leading spaces that seem to cause the problem.

Steven
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 287
Default Trim Leading Spaces

They probably aren't spaces but some other character which doesn't display.
Try copying one of the "leading spaces" and then use Edit Replace on your
range of cells replacing the offending character with nothing [just paste
your charcater into the "find" box]

"Steven" wrote:

I forgot to mention:

If I just put an example in excel with spaces then the text then spaces and
test with Trim(CellAddress) then it will trim properly.

This was something taken off the internet. I have see in other posts where
you have to test the characters but I have not been able to make those work.
It is the leading spaces that seem to cause the problem.

Steven

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
trim leading spaces captain bob Excel Discussion (Misc queries) 2 August 3rd 06 02:57 PM
How to trim spaces from entered text in cell using exisiting functions? rj Excel Worksheet Functions 4 April 19th 06 08:40 PM
How do I add leading spaces to a value? Chris Brown Excel Worksheet Functions 3 March 3rd 06 05:23 PM
Strip leading spaces from cell Pete Excel Worksheet Functions 3 July 31st 05 02:26 AM
Remove Leading Spaces Kirk P. Excel Discussion (Misc queries) 3 March 3rd 05 01:30 PM


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