Howto transform a colum with postive and negative values, which is loaded as text into a column with decial values without errors. the minus sign seems to make the error:
I use a german version of excel 365 on windows 10
Finally solve the problem: It was q quircky minus-sign, which had to be replaced by a standard minus sign before changing type to decimal. Unfortunatley at first sign this quirky decimals looked like nomral ones
Related
With a dataset such as this:
Date, Value
04.03.2020, 13.35
04.03.2020, 13.8
04.03.2020, 21.21
You can split the data using Data > Text to columns and specifying the value separator.
The problem is that Excel recognizes 13.8 as august 13, so the output is:
Date Value
04.03.2020 13.35
04.03.2020 13.aug
04.03.2020 21.21
How can I make sure that Excel never interprets decimal numbers such as 13.8 as dates?
I'm working in a region that uses , as decimal separator, but I often have to work with data that is set up with . as the decimal separator. One work-around is of course to replace , with ; and . with , before opening a .csv file. And if the only other solution is to set it up with VBA, I'm perfectly able to do so myself. But I often find myself trying to help colleagues on their computers without my own VBA configurations ready to go. So if there's any other way to do this using standard Excel system settings, that would be great!
This little problem has bugged me for years and I'm eager to get rid of it once and for all.
Edit:
I'm running Excel version 1908 on Windows 7, Office 365.
This problem often occurs when I'd like to inspect csv files that are recognized as Excel files on my system. There have been suggestions to format the cells as General before splitting the data. That does not seem to work on my end.
Another solution is to get what you want with formulas:
Formula for Dates:
=TEXT(LEFT(A2,FIND(",",A2,1)-1),"General")
Formula for Values:
=TEXT(MID(A2,(FIND(",",A2,1)+2),(LEN(A2)-(FIND(",",A2,1)+1))),"General")
Results:
During Text to Column process at Step 3 you have the option to to select Data Column Format you could also select the Value column and play around with Text or General formating.
Recently, I confronted a very strange thing in Microsoft Excel. I made a dataframe in Python 3.6 and filled it with some integer numbers, then I used "to_csv" function to get csv output. I opened the file with Microsoft Excel for doing basic statistical analysis and drawing some charts, however; Microsoft Excel doesn't recognize the numbers in the cells as number. For example, when I add two cell, the result will be zero, no matter what are the numbers.
This is a screenshot from my my Excel environment:
In the yellow cell (C101) I tried to get the sum of cells in column C, but as I explained the sum function (and all the other functions like Count or Max) doesn't work properly. I also, have to say, all the cells have "Number" data type. I'm quite confused, any suggestion would help.
I would have written the answer as a comment, but my reputation is too low.
By default, the decimal seperator is set to a dot ('.'). You have to switch it to a comma (',') like this:
df.to_csv(file, decimal=',')
EDIT:
I forgot that you also have to set the seperator, since its default value is comma:
df.to_csv(file, sep=';', decimal=',')
for some reason my excel drops error when multyipling on if statemtn
for example
=IF(A1>B1;A1*5;A1)
I cant do nothing, if Id skip it as 5x5 for exmaple, than it works perfect, though If I use an cell for a multiply, it drops me Value error.
I examined it and calculation steps are:
=IF(TRUE;"20.00"*5;A2), the 20.00 is what is A2 cell.
=IF(TRUE;#VALUE!;A2)
So I am stuck and broken...
This is strange. When multiplying a string that looks like a number, Excel normally automatically converts the string to a number. Try this to force conversion:
=IF(A1>B1;VALUE(A1)*5;A1)
If that still results in an error, then Excel can't recognize "20.00" as a number. Does your locality use a comma instead of a fullstop for the decimal places? If so, try putting 20,00 in A1.
Also, try checking your locality settings. From the Start menu, search for Locality or Language, then choose to change your Date, Time or Number Formats. Click Additional settings and check what your Decimal Symbol is. You need to use this decimal symbol in Excel for it to correctly recognize numbers.
Please use this formula,
=IF(A1>B1,PRODUCT(A1,5),A1)
So i have some rdfs that download from the server through rwservlet as excels (xls). My question is: can i use excel formulas like sum on the report returned data?
I tried formatting the data (i think here relies the problem as it seem it doesn't affect the data that's already there) and modifying the decimal separator to "." from the rdf. Neither work, not separate or together; the sum formula returns 0. However if i overwrite new data over report data in a field, sum works.
It seems to me it sees all the data returned from the report like text and the formatting doesn't affect the already there data.
Thank you
I go to the root of the problem: the format mask in the rdf was adding a space for sign for the positive numbers. Hence excel was not recognizing it as a number. Problem is after i put a "-" in the format mask to get rid of the space excel re-formats the number automatically from 1.00 to 1 for example. So basically the format mask in the rdf is overwritten, i could not use it at all and i'd get the same result.
A colleague and I encountered a behavior in Excel which isn't clear to us.
Background:
We have a tool which converts an Excel sheet into a table format. The tool calculates the formulas which are in excel and replaces variables inside it with specific values.
The excel tool is used by one of our customers who use values like (8) or (247).
These Value are automatically translated by excel to -8 or -247.
Question:
I saw that many people want to display negative numbers in parentheses. But why would Excel change values in parentheses to a negative number?
I know that I could simply change the cell config to text and this would solve the problem but I wonder if there is a reason for the behavior, since there seems to be no mathematical reason for this.
Its simply the different format of cells you are bringing the "values from" and "pasting to". ..... numbers with parentheses are in cells with "accounting" format and negatives are stored in general or standard number formated cells. To resolve you can change the format of destination cells to accounting using cell formatting as number>accounting.
To answer the why, it's because accountants put negative numbers in brackets for readability
Unfortunately, this is one of the excel feature/bugs that helps some folks and frustrates others. When opening a file or pasting content, excel will immediately and always try to parse any values into formats it deems appropriate, which can mess up data like:
Zip Codes / Tel. # → Numeric: 05401 → 5401
Fractions → Dates: 11/20 → Nov, 20th YYYY
Std. Errors → Negative Numbers: (0.1) → -0.1
For some workarounds , see Stop Excel from automatically converting certain text values to dates
Once the file is open/pasted, the damage is already done. At that point, your best bet is:
Updating the field and displaying as text (appending with ') to prevent re-casting
Formatting the field if the operation wasn't lossy and is just presenting the info differently
Running a clean if/else to pad or other convert your data based on the identified errors
Specific to displaying values back in parens, if excel is converting them and treating them like negative numbers (which may or may not be the appropriate way to actually store the data), you can apply a different format to positive and negative numbers to wrap back in parens.
It is standard practice to write negative values as numbers in parentheses, especially in accounting. This makes negative values stand out much more than a simple negative hyphen; compare -1 and (1).
Excel is a tool very commonly used by accountants and supports accountant-style spreadsheets. Therefore, entering (100) means having a value of -100, even if there is no minus hyphen!
Here is a fun fact, if you enter (-10), Excel will treat it as normal text.