[Solved] Number Re-formatting
[Solved] Number Re-formatting
Hello Everyone,
(I am using Version 3.1.1. Build 9420 from 9-15-2009.)
Opened a .csv file with Calc that was generated from my Paypal account.
Noticed that the column would not SUM. Scratched my head for a minute, then noticed that the numbers were formatted as text. The apostrophe was added to each cell in the column. (I have attached a screen shot for example purposes.)
As you can see, Calc sees Column B as being "numbers." It does not recognize the contents of Column C to be numbers.
Three concerns...
1. Why did Calc see these numbers as "text" when they were not text...
2. The column could not be reformatted as "numbers." Why?
3. I searched and searched for a way to remove the apostrophe so the contents of the cells in that column would once again become numbers. Could not figure out how to do so.
For the record, Excel 2007 handles this without a hitch.
Thanks very much for your help.
Tad
(I am using Version 3.1.1. Build 9420 from 9-15-2009.)
Opened a .csv file with Calc that was generated from my Paypal account.
Noticed that the column would not SUM. Scratched my head for a minute, then noticed that the numbers were formatted as text. The apostrophe was added to each cell in the column. (I have attached a screen shot for example purposes.)
As you can see, Calc sees Column B as being "numbers." It does not recognize the contents of Column C to be numbers.
Three concerns...
1. Why did Calc see these numbers as "text" when they were not text...
2. The column could not be reformatted as "numbers." Why?
3. I searched and searched for a way to remove the apostrophe so the contents of the cells in that column would once again become numbers. Could not figure out how to do so.
For the record, Excel 2007 handles this without a hitch.
Thanks very much for your help.
Tad
Last edited by tad on Wed Sep 30, 2009 2:51 am, edited 1 time in total.
-
- Posts: 14
- Joined: Mon Sep 28, 2009 4:19 pm
Re: Number Re-formatting
Try opening your file with notepad, and using the replace function to replace all of the ' with nothing. Enter that character in the find box, and leave the replace box blank. Save the file, and see what happens!
OOo 3.0 Windows Vista
Re: Number Re-formatting
Thanks very much for taking the time to help.billiam1185 wrote:Try opening your file with notepad, and using the replace function to replace all of the ' with nothing. Enter that character in the find box, and leave the replace box blank. Save the file, and see what happens!
Tad
Re: Number Re-formatting
Would be happy to. I am being told, though, that I cannot post a file with the .csv extension. Hmmm. Any ideas?aukejan wrote:Can you please upload one of your CSV files?
Tad
Re: Number Re-formatting
Zip it up. You can upload .zip files. If it is too big put it on something like MediaFire and post the link here.
Ubuntu 14.10 Utopic Unicorn, LibreOffice Version: 4.3.3.2
Gurkha Welfare Trust
Gurkha Welfare Trust
Re: Number Re-formatting
Excellent. Here is the zip file that contains the file "test_file.csv". Thanks for the help.TheGurkha wrote:Zip it up. You can upload .zip files. If it is too big put it on something like MediaFire and post the link here.
Tad
- Attachments
-
- test_file.zip
- (349 Bytes) Downloaded 185 times
Re: Number Re-formatting
Probably because they were quoted in the CSV file. A leading single quote is the only way I know of to get Calc to treat values in a CSV file as text.tad wrote:... Three concerns...
1. Why did Calc see these numbers as "text" when they were not text...
I assume you mean that changing the cell format didn't solve your problem--right? That's because changing the cell format never changes the type of the value that's stored in the cell. The format can only change the way the value is displayed. If your "SERIAL" values were read as text values, changing the cell format can not change them into numeric values.2. The column could not be reformatted as "numbers." Why?
Calc guesses a value's type when it is entered. To change the type, you have to enter the value again, and give some different clue as to what the type should be, like adding an apostrophe at the start.
You can't remove it because it's not there. The apostrophe is just a clue that Calc should interpret the entry as text when normally it would interpret it as a number. When the value is stored, Calc sees the apostrophe, stores the value as text, then throws the apostrophe away. When you edit the value, Calc sees that the apostrophe is needed, and puts it back to save you from having to type it. When you finish editing, Calc throws it away again.3. I searched and searched for a way to remove the apostrophe so the contents of the cells in that column would once again become numbers. Could not figure out how to do so.
It's a confusing way to handle the problem, but it's not entirely Calc's fault: it's been this way since the dawn of spreadsheets.
No doubt. Excel is quite good at doing things without bothering the user, but not infrequently the convenience ends up wrapped around the user's neck because Excel guessed wrong and the blissful user never knew there was an issue.For the record, Excel 2007 handles this without a hitch.
Do you really mean to add up a column of serial numbers?
You can change numeric text to numeric values using Edit > Find & Replace.
1) Select the cells (or the whole column)
2) Format the cells as some numeric format, or just as "Default" (Format > Default Formatting).
3) Edit > Find & Replace
Search for: .*
Replace with: &
Options: Regular expressions: YES; Current selection only: YES
Click "Replace all."
This has the effect of re-entering the values but without the apostrophe.
NOTE: It will also throw out any leading zeros that may be important for other purposes.
Alternatively, you can leave the numbers as text, and add them with a formula something like =SUMPRODUCT(VALUE(C2:C11))
AOO4/LO5 • Linux • Fedora 23
Re: Number Re-formatting
PS: With OOo 3.1.1 and your sample file, I can't reproduce the problem as you described it. The SERIAL column comes in as numeric data for me.
AOO4/LO5 • Linux • Fedora 23
Re: Number Re-formatting
"Do you really mean to add up a column of serial numbers?"
- - - -
This was a different file than the one I dealt with originally. It had the same behaviors as the other, though. I used the serial numbers column as an example.
Thanks VERY much for the excellent explanation.
Tad
- - - -
This was a different file than the one I dealt with originally. It had the same behaviors as the other, though. I used the serial numbers column as an example.
Thanks VERY much for the excellent explanation.
Tad
Re: [Solved] Number Re-formatting
I have this same problem with OO 3.1.1 - please note that prior versions of Calc handled numbers just fine when importing or opening a txt/csv file. Something changed in 3.1.1.
OpenOffice 3.1.1 on Ubuntu Linux 9.10 or Mint Linux 8
Re: [Solved] Number Re-formatting
Can you attach a few sample lines of your input? Without that, all anyone can do is guess what the problem might be.
AOO4/LO5 • Linux • Fedora 23
Re: [Solved] Number Re-formatting
No, your problem is totally unrelated to this one and you should go back to your own topic instead of hi-jacking this one.coakley wrote:I have this same problem with OO 3.1.1 - please note that prior versions of Calc handled numbers just fine when importing or opening a txt/csv file. Something changed in 3.1.1.
http://user.services.openoffice.org/en/ ... =9&t=26626
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: [Solved] Number Re-formatting
I posted in this topic because one of the replies to my question led me here - quite on purpose. The issue here and my issue are certainly not the same, but they just as certainly could be caused by the same changes to the code. I thought it might be useful to point out that my problem did not exist in Calc until the 3.1.1 iteration and that perhaps that might be true of this issue as well.
Sorry to ruffle ...
Sorry to ruffle ...
OpenOffice 3.1.1 on Ubuntu Linux 9.10 or Mint Linux 8
- Scott M. Sanders
- Posts: 35
- Joined: Mon Dec 22, 2008 6:41 pm
- Location: Ashland, Ohio, USA
Re: [Solved] Number Re-formatting
Is Calc ever gonna get this right?
LibO 3.5, OOo 3.4 beta 1, White Label 3.3; XP Pro SP3, Vista Home Premium SP2, 7 Pro SP1 64-bit; Ubuntu 11.10, Fedora 11 to 16, CentOS 6.2
Re: [Solved] Number Re-formatting
The test file works fine for me in 3.1.1 an 3.2RC2
When you are in the import window:
Select tab separator.
In the header of the first column select M/D/Y (pick with right bottom)
In the header of the second column select US, if you don't use the dot as decimal point.
When you are in the import window:
Select tab separator.
In the header of the first column select M/D/Y (pick with right bottom)
In the header of the second column select US, if you don't use the dot as decimal point.
LibreOffice 3.5.4 AOo-3.4 on Win 7 Ultimate