csv format hide decimal part when is opened with excel - excel

I have a csv file. One column has a number with 2 decimal digits like 100,00. But hides the trailing zeros (100). When I open it with notepad is 100,00.

Welcome to the mad world of CSVs and Excel.
That's one of the problems with the CSV files and excel: The value trailing zeros aren't shown by default. You can always modify the CSV within excel and then save it as *.xls or *.xlsx files.
There is no way to tell Excel to open a CSV with showing numbers per default with all given digits, if they are zero because excel does interpret them as "Standard".
If you don't need to work with the numbers as numbers you can always exchange the , with a . (that might be depending on the locale, not sure). Or just export it as a String:
The CSV:
test
="100,00"
13,37
100.00
=100,01
will produce the following output (locale de_DE):
In general, if you need to work with excel and want as much pre-formatted as possible, don't use CSV.

CSV is just comma-separated values. Just values. No formatting hints are included. So you can't have a number's display format specified within the CSV -- the numbers will be displayed in whatever format Excel shows.
If you'd rather you can change the default display format in Excel (for all sheets, not just CSV's). Not what you're asking, but perhaps it will be your preference. See How to change the default number format in Excel? for details on that option.

Related

Change decimal and thousand separator in Open XML for Excel files

I'm trying to generate an Excel file using Open XML. Sometimes I need the numeric values on each cell to be displayed with the american separator pattern - comma for thousand, dot for decimal. By default, open XML will show me those values in the portuguese pattern - dot for thousand, comma for decimal.
Is there a property in open XML that would work as if I were going to Excel Options, Advanced and changing the separators for all numeric values in the file?
Thank you.

Uipath overdrives Excel file Locale configuration

I have to process some excel files that comes with an specific Numeric format that is es-CL
that has dots as a thousand separator and comas as decimal separator.
Thousand separator = 100.000.000
Decimal= 1.000.000,1213
When i use any of the excel activities the numbers inside the excel change their format and leaves them like this
Before: 13.640
After:13,64
the thousand separator becomes a coma and the 0 is erased.
I already tried the “Preserve Format” option, replacing the dots with a "" and i get the same result.
Is there a way to change the locale of the excel activities, if it not, what are my options?

Stop Excel from evaluating cell contents?

Is there a way to stop Excel 2010 from doing math on a bunch of cells containing multiple numbers with leading plus or minus signs? E.g.
-706795 -1456130 -1869550 -936304 -1729830 -1737860 -687165 -16807800
Right now it sums the numbers up into one value. I would like them displayed as above. Formatting the cell as text doesn't work. I get this data from a CSV and have limited control over its contents...
Use a single quote
'-706795 -1456130 -1869550 -936304 -1729830 -1737860 -687165 -16807800
Use the text import wizard to load each value into an individual column. You may have to rename the CSV file as '.txt' to get the import wzard up by default, (shameless rep seeking here:).

How can I prevent leading zeroes from being stripped from columns in my CSV?

I need to upload a CSV file, but my text data 080108 keeps converting to a number 80108. What do I do?
Use Quoted CSV
Use quotes in your CSV so that the column is treated as a string instead of an integer. For example:
"Foo","080108","Bar"
I have seen this often when viewing the CSV using Microsoft Excel. Excel will truncate leading zeros in all number fields. if the output is not coming from excel then check the output in note pad. If it is coming from excel you need to add a single quote mark ' to the beginning of each zip code. then excel will retain the leading 0.

Some but not all Excel numbers show as a date

I have a big .xls file. Some numbers show as a date.
31.08 shows as 31.aug
31.13 shows as 31.13 (that is what i want all columns to be)
When I reformat 31.aug to number it shows as 40768,00
I have found no ways to convert 31.aug to 31.08 as a number. All I am able to do is to reformat 31.aug as d.mm and then it shows as 31.08 and when I try to reformat it from 31.08 to number it shows as 40768,00. No way to cheat Excel using different types of cell formats.
How's your regional settings? There are some Regions where the short date is identified by dd.mm.yyyy. (Estonian, for instance). Maybe if you change the regional settings for US / UK and paste the data again it won't be changed.
Worked in a small test I did here. Hope it helps.
Internally Excel stores Dates as integer. 1 is January 1. 1900. If you entered something that Excel interprets as a date then it will be converted into an integer. I think from this point on there is no way back.
There is an setting in Options on the tab "international" where you can define your decimal separator. If you set this to ".", then your Excel should accept 30.12 as decimal number and not as date.
As pointed out by others, Excel interprets some of your data as a date instead of a number, which depends on your regional settings. To avoid this happening try Tiago's and stema's responses, they will work depending on your regional settings.
To repair your problem in a large file after it has happened without re-entering/re-importing your data, you can use something like
=DAY(B5)+MONTH(B5)/100
to convert a "date" back to a number. Excel will still display it as a date when you first enter this, but when you reformat it as "Number" now it will display the value you originally entered.
Since your column seems to contain a mix between correct numbers and dates, you need to add an if() construct to separate the two cases. If you haven't changed the display format yet (i.e. it still displays 31.Aug) you can use
=IF(LEFT(CELL("format";B7);1)="D";DAY(B7)+MONTH(B7)/100;B7)
which checks if the format is a "D"ate format. If you have already changed the format to Number, but know all your correct data is below 40000, you can use
=IF(B5>40000;DAY(B5)+MONTH(B5)/100;B5)
As suggested above, go to Control Panel - Region and Language - Advanced Settings - Numbers - and change the Decimal Symbol from "," to "."
Good luck!
The data you are pasting, is it by any chance a pivot table.
For example, like you, I am copying a lot of data into a large spreadsheet. The data I am copying is from another sheet and it is a pivot table.
If I paste normally, half will show up as numbers, which they are in the source file and half will show up as dates, for no reason, which drives me insane.
If I Paste->Values however, they will all show up as numbers, and as I don't need the pivot functionality in the destination file this solution is fine.
All you have to do is format cell.
1-right click on the cell where you want to insert the number.
2-then click on Number and select 'General' from the number menu.
Hope this will help future people with the same issue.

Resources