Apache OpenOffice (AOO) Bugzilla – Issue 92163
Calc fails to calculate simple formula
Last modified: 2008-07-29 13:17:14 UTC
Steps to reproduce: 1. Create a new spreadsheet 2. In cell C1, enter 100 3. In cell D1, enter the text HUF 4. In cell E1, enter this formnula: =IF(D1="HUF";"0.20";"0.00") 5. In cell F1, enter this formula: =(1+E1)*C1 As a result, E1 becomes 0.20, which is OK. However, F1 shows a value of 100. Expected: F1 should become (1 + 0.20)*100 = 120
If you want a number, you must write it as number. "0.2" is a text and texts are treated as zero if you try to calculate with them. Correct: =IF(D1="HUF";0.20;0.00)
Closing. Error in using formula
Created attachment 55377 [details] Testcase for wrong formula evaluation
Clarification: I initially used Calc to open an MS Office 2000 Excel spreadsheet that had the formulas decribed above. The formula worked fine in Excel. I noticed the problem (calculated field wrong), created a new Calc spreadsheet, and copied over the formula from the Excel spreadsheet to verify the behavior. Please check the test case I just attached. Language for the cells is Hungarian, but that shouldn't affect the behavior.
Importing from Excel is a problem, see issue 5658. You will have to correct your spreadsheet, to use numbers where you will calculate with them. *** This issue has been marked as a duplicate of 5658 ***
closing duplicate. You might vote for issue 5658 to get a better solution for importing Excel spreadsheets.
closed as duplicate