| View previous topic :: View next topic |
| 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 |
|
| Back to top |
|
 |
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 |
|
| Back to top |
|
 |
8daysaweek.co.uk Super User


Joined: 29 Nov 2003 Posts: 2130 Location: UK
|
|
| Back to top |
|
 |
David Super User


Joined: 24 Oct 2003 Posts: 5668 Location: Canada
|
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. |
|
| Back to top |
|
 |
|
|
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
|