[Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register]

Author Message
gvblack
Newbie

Joined: 11 Jun 2005
Posts: 1

 Posted: Sat Jun 11, 2005 12:11 pm    Post subject: Converting Values I get input from another source that contains several numbers in one cell. I would like to seperate these numbers out so I can work with them. For example, a cell might be: Gold 2,835,581 I want just the 2,835,581 returned as a number. Or, 0 1,500 0 4,000 I'd want to be able to get each of those 4 values returned as a number. TIA
carl
Super User

Joined: 21 Apr 2003
Posts: 920
Location: Germany

 Posted: Sun Jun 12, 2005 11:18 pm    Post subject: Try playing around with LEFT MID RIGHT and FIND Gold 2,835,581 B1 =LEFT(A1;(FIND(" ";A1))) returns everything before the first space :Gold C1 =MID(A1;5;6) returns digits 5 to 11 :2,835 D1 =RIGHT(A1;3) returns last three digits :581_________________carl Using OpenOffice.org 2 on XP sp2
8daysaweek.co.uk
Super User

Joined: 29 Nov 2003
Posts: 2130
Location: UK

 Posted: Sun Jun 12, 2005 11:21 pm    Post subject: Hi gvblack, You may also find some useful tips here: http://www.oooforum.org/forum/viewtopic.phtml?t=20709 BFN ,_________________James www.8daysaweek.co.uk - A User-Focused OOo site
David
Super User

Joined: 24 Oct 2003
Posts: 5668

Posted: Mon Jun 13, 2005 4:01 am    Post subject: Re: Converting Values

 gvblack wrote: I get input from another source that contains several numbers in one cell. I would like to seperate these numbers out so I can work with them. For example, a cell might be: Gold 2,835,581 I want just the 2,835,581 returned as a number. Or, 0 1,500 0 4,000 I'd want to be able to get each of those 4 values returned as a number. TIA

Try this on a small simulation file with the same format as you describe:

1. Assuming the file as a text file, using a program like Metapad, find and replace all spaces by semi-colons ...be sure you don't have a space after the last entry in each line.

2. There is a program called CSVEd I've mentioned before to do wonderful things with CSV files. There, set the delimiter to a semi colon, then load the file. It will [should] appear with items in separate columns. Change the delimiter to a comma, then resave as a CSV file, which should then load into Calc as you want it to.

I had some success with this with a small sample:

0 1,500 0 4,000
1 2 3 4
5 6 7 8

became ....

0;1,500;0;4,000
1;2;3;4
5;6;7;8
and I saved that with a .csv extension

I used the semi-colon because you had a comma in your numbers. Calc seemed to handle that OK, but formatting was lost. However, the values were separated into individual columns.

David.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT - 8 Hours Page 1 of 1

 Jump to: Select a forum OpenOffice.org Forums----------------Setup and TroubleshootingOpenOffice.org WriterOpenOffice.org CalcOpenOffice.org ImpressOpenOffice.org DrawOpenOffice.org MathOpenOffice.org BaseOpenOffice.org Macros and APIOpenOffice.org Code Snippets Community Forums----------------General DiscussionSite Feedback
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