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

[Solved]What command to crop a cell's contents?

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


Joined: 25 Jun 2010
Posts: 1

PostPosted: Fri Jun 25, 2010 8:48 pm    Post subject: [Solved]What command to crop a cell's contents? Reply with quote

Hi,

I have a column of data with cells that contain a long mix of characters and numbers...how can i crop the data in these cells to contain only the first 5 letters/numbers in the cell, and drop the rest?

I have been racking my brain as to how to do this and I was hoping folks here could help. I'm not sure what to search for so I'm sorry if this has been asked before!

Thanks

~Ian


Last edited by aeroian on Sat Jun 26, 2010 5:17 pm; edited 1 time in total
Back to top
View user's profile Send private message
Robert Tucker
Moderator
Moderator


Joined: 16 Aug 2004
Posts: 3407
Location: Manchester UK

PostPosted: Sat Jun 26, 2010 3:07 am    Post subject: Reply with quote

Select column.

Open search/replace Ctrl+F. Search for: \<(.{5}).*\> Replace with: $1

Under "More Options" check "Current selection only" and "Regular expressions".

Replace All.
_________________
OpenOffice 4.0.0 and LibreOffice 4.x.x on Fedora 20, Ubuntu 13.10, Windows 8.1 Preview (Triple Boot)
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 Jun 26, 2010 3:16 am    Post subject: Reply with quote

Say the values to be cropped are in column A.
In the next available empty column enter this formula...
=LEFT(TRIM(A1);5)
Fill this formula down as far as needed.
Copy the results of the formula then go Edit|Paste Special to bring up the "Paste Special" dialog. Under the "Selection" heading deselect "Paste all", select "Text strings" and deselect all the other options. Click OK.
If you a satisfied with the results you can use copy/paste to replace the original column A values with the cropped values.

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