#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 79
Default Delete spaces

Hi All

Is there a formula that deletes all the spaces at the end of a cell of text
but not the spaces in the middle of the cell?

Cheers Rexmann

PS Excel 2003
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,316
Default Delete spaces

Use the TRIM function:

=TRIM(A1)

It removes leading and trailing spaces
--
Kevin Backmann


"rexmann" wrote:

Hi All

Is there a formula that deletes all the spaces at the end of a cell of text
but not the spaces in the middle of the cell?

Cheers Rexmann

PS Excel 2003

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Delete spaces

On Fri, 7 Mar 2008 05:41:02 -0800, rexmann
wrote:

Hi All

Is there a formula that deletes all the spaces at the end of a cell of text
but not the spaces in the middle of the cell?

Cheers Rexmann

PS Excel 2003


The TRIM worksheet function will delete spaces at the beginning and end, and
also leave only a single space between words within the text string.

To delete ONLY the spaces at the end, you can try this formula:

=LEFT(A1,LEN(A1)-SUMPRODUCT(--(TRIM(MID(A1,1+
LEN(A1)-ROW(INDIRECT("1:"&LEN(A1))),255))="")))

--ron
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Delete spaces

On Fri, 07 Mar 2008 09:07:57 -0500, Ron Rosenfeld
wrote:

On Fri, 7 Mar 2008 05:41:02 -0800, rexmann
wrote:

Hi All

Is there a formula that deletes all the spaces at the end of a cell of text
but not the spaces in the middle of the cell?

Cheers Rexmann

PS Excel 2003


The TRIM worksheet function will delete spaces at the beginning and end, and
also leave only a single space between words within the text string.

To delete ONLY the spaces at the end, you can try this formula:

=LEFT(A1,LEN(A1)-SUMPRODUCT(--(TRIM(MID(A1,1+
LEN(A1)-ROW(INDIRECT("1:"&LEN(A1))),255))="")))

--ron


Or (slightly shorter):

=LEFT(A1,LEN(A1)+SUMPRODUCT(-(TRIM(MID(A1,1+
LEN(A1)-ROW(INDIRECT("1:"&LEN(A1))),255))="")))

--ron
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default Delete spaces

Maybe one of these:

For all text lengths:
=LEFT(A1,COUNT(INDEX(1/(TRIM(RIGHT(A1,ROW(INDEX($A:$A,1):
INDEX($A:$A,LEN(A1)))))<""),0)))

or...if the text length will be 255 chars or less:
=LEFT(A1,COUNT(INDEX(1/(TRIM(RIGHT(A1,COLUMN($1:$65536)))<""),0)))

Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)

"rexmann" wrote in message
...
Hi All

Is there a formula that deletes all the spaces at the end of a cell of
text
but not the spaces in the middle of the cell?

Cheers Rexmann

PS Excel 2003




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
An easy way to delete spaces in a cell... LEG New Users to Excel 3 November 12th 07 05:27 PM
delete single spaces Mark R Excel Discussion (Misc queries) 5 May 31st 07 05:03 PM
How do I delete spaces from the end of text George Excel Discussion (Misc queries) 4 September 11th 06 07:33 AM
how do I delete the last two spaces in a cell brantty Excel Discussion (Misc queries) 2 July 27th 06 01:14 AM
delete spaces CHARI Excel Worksheet Functions 2 September 9th 05 10:38 AM


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