ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Find cells with a space at the end (https://www.excelbanter.com/excel-discussion-misc-queries/255180-find-cells-space-end.html)

Alain Dekker[_2_]

Find cells with a space at the end
 
How do I find all cells (with text in it) that ends with a space ie.
"This is some text "
which I either want to highlight or automatically fix to:
"This is some text"

I'm using Excel 97. I have tried to turn on showing special character like
you can in Word (where a space appears as a dot), but couldn't find that
command. The Find command also doesn't help.

Many thanks,
Alain



Ron Rosenfeld

Find cells with a space at the end
 
On Wed, 3 Feb 2010 12:02:17 -0000, "Alain Dekker"
wrote:

How do I find all cells (with text in it) that ends with a space ie.
"This is some text "
which I either want to highlight or automatically fix to:
"This is some text"

I'm using Excel 97. I have tried to turn on showing special character like
you can in Word (where a space appears as a dot), but couldn't find that
command. The Find command also doesn't help.

Many thanks,
Alain


The trailing space may be the normal <space character, but, especially if the
source of this data was an html document (or downloaded from the web), might be
a <nbsp (char(160).

To determine if the last character is a <space, something like:

=ISNUMBER(FIND(" ",A1,LEN(A1)))

To determine if the last character is a <nbsp, something like:

=ISNUMBER(FIND(CHAR(160),A1,LEN(A1)))


To remove the last character:

=IF(ISNUMBER(FIND(" ",A1,LEN(A1))),LEFT(A1,LEN(A1)-1),A1)
or
=IF(ISNUMBER(FIND(CHAR(160),A1,LEN(A1))),LEFT(A1,L EN(A1)-1),A1)
--ron

Eduardo

Find cells with a space at the end
 
Hi,
in an adjacent column do

=trim(a1)

being a1 the cell where you have the text

"Alain Dekker" wrote:

How do I find all cells (with text in it) that ends with a space ie.
"This is some text "
which I either want to highlight or automatically fix to:
"This is some text"

I'm using Excel 97. I have tried to turn on showing special character like
you can in Word (where a space appears as a dot), but couldn't find that
command. The Find command also doesn't help.

Many thanks,
Alain


.


Gary''s Student

Find cells with a space at the end
 
Try this small macro:

Sub blankremover()
For Each r In ActiveSheet.UsedRange
v = r.Value
If Right(v, 1) = " " Then
r.Value = Left(v, Len(v) - 1)
End If
Next
End Sub

--
Gary''s Student - gsnu201001


"Alain Dekker" wrote:

How do I find all cells (with text in it) that ends with a space ie.
"This is some text "
which I either want to highlight or automatically fix to:
"This is some text"

I'm using Excel 97. I have tried to turn on showing special character like
you can in Word (where a space appears as a dot), but couldn't find that
command. The Find command also doesn't help.

Many thanks,
Alain


.


Alain Dekker[_2_]

Find cells with a space at the end
 
Thanks for all those answers!

"Gary''s Student" wrote in message
...
Try this small macro:

Sub blankremover()
For Each r In ActiveSheet.UsedRange
v = r.Value
If Right(v, 1) = " " Then
r.Value = Left(v, Len(v) - 1)
End If
Next
End Sub

--
Gary''s Student - gsnu201001


"Alain Dekker" wrote:

How do I find all cells (with text in it) that ends with a space ie.
"This is some text "
which I either want to highlight or automatically fix to:
"This is some text"

I'm using Excel 97. I have tried to turn on showing special character
like
you can in Word (where a space appears as a dot), but couldn't find that
command. The Find command also doesn't help.

Many thanks,
Alain


.





All times are GMT +1. The time now is 06:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com