OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Issues getting TRIM to work

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
physical_harry
Newbie
Newbie


Joined: 12 May 2012
Posts: 2
Location: York, UK

PostPosted: Sat May 12, 2012 3:21 pm    Post subject: Issues getting TRIM to work Reply with quote

Hi all, I've only had a quick search around (so apoloogies if already covered, I'm trying to get something done very fast!), but I'm just trying to clear the trailing/leading spaces in a database. At first tried find & replace with '[:space:]+ but it only cleared trailing spaces (and I have quite a few leading ie before text).

I then tried TRIM, which appeared to be working, and then when I went to try it on my original sheet it stopped working! What I tried is '=TRIM(A1)' then dragged down to apply to the whole column, and across for the whole sheet.

So does anyone have any idea what I'm doing wrong, is it something which is even possible?!

Thanks,

Harry
Back to top
View user's profile Send private message
ken johnson
Super User
Super User


Joined: 23 Apr 2009
Posts: 2032
Location: Sydney, Australia

PostPosted: Sat May 12, 2012 5:12 pm    Post subject: Reply with quote

One possibility is the leading space is not a space (ASCII 32).
It could be a non-breaking space (ASCII 160).
Test using the CODE function which returns the ASCII code for the first character.
If =CODE(A1) returns 160 the first character in A1 is a non-breaking space that is not removed by the TRIM function (or the CLEAN function).

Ken Johnson
_________________
If your problem has been solved please add "[Solved]" to the beginning of your first post title (edit button).
Back to top
View user's profile Send private message
physical_harry
Newbie
Newbie


Joined: 12 May 2012
Posts: 2
Location: York, UK

PostPosted: Sat May 12, 2012 6:30 pm    Post subject: Reply with quote

Ah yes I just checked, it is 160 as you thought. So is there any solutions to remove these spaces other than manually (I really hope so...!)

Thanks for your help Ken
Back to top
View user's profile Send private message
ozzie
OOo Advocate
OOo Advocate


Joined: 29 Jul 2010
Posts: 397
Location: victoria

PostPosted: Sat May 12, 2012 10:11 pm    Post subject: Reply with quote

=SUBSTITUTE(A1;CHAR(160);"")
_________________
If your problem has been solved please add "[Solved]" to the beginning of your first post title (edit button).
Back to top
View user's profile Send private message
ken johnson
Super User
Super User


Joined: 23 Apr 2009
Posts: 2032
Location: Sydney, Australia

PostPosted: Sat May 12, 2012 10:54 pm    Post subject: Reply with quote

You can also use Find & Replace.
Copy one of the non-breaking spaces into the "Search for" textbox and leave the "Replace with" textbox empty.

Ken Johnson
_________________
If your problem has been solved please add "[Solved]" to the beginning of your first post title (edit button).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group