Recent

Author Topic: fpspreadshet calculates wrong when the time is 00:00  (Read 4325 times)

Soner

  • Sr. Member
  • ****
  • Posts: 305
fpspreadshet calculates wrong when the time is 00:00
« on: August 30, 2018, 01:42:21 pm »
fpspreadshet calculates wrong when the time is 00:00.
open the attached file with Libreoffice and spready and look at cells E10..E17 (values) and H10..H17 (formulas).

(I wanted write bug report but I could not remember my account from this computer).

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: fpspreadshet calculates wrong when the time is 00:00
« Reply #1 on: August 30, 2018, 01:58:54 pm »
Can you reproduce this with a simpler formula? My first idea is that this could be due to some round-off error since you calculate and compare differences between TDateTime values which are floating point numbers.

Soner

  • Sr. Member
  • ****
  • Posts: 305
Re: fpspreadshet calculates wrong when the time is 00:00
« Reply #2 on: August 30, 2018, 02:21:07 pm »
It looks like parser error.
Look the formula for h10:
=(IF(E10="",,(IF(E10>D10,E10-D10,((1-D10)+E10))*24))-(IF(G10="",,(IF(G10>F10,G10-F10,((1-F10)+G10))*24))))

You can simplify it  when you remove second part after - and add ) :

=(IF(E10="",,(IF(E10>D10,E10-D10,((1-D10)+E10))*24)) )
H10 shows now nothing.(It should show 13,00)

One more step simpler:
=IF(E10>D10,E10-D10,((1-D10)+E10))*24
now it shows 13,00

Edit:
13 is correct value for simplified formula for row 10. (calculating of worktime only "Arbeitszeit")
« Last Edit: August 30, 2018, 02:28:56 pm by Soner »

Soner

  • Sr. Member
  • ****
  • Posts: 305
Re: fpspreadshet calculates wrong when the time is 00:00
« Reply #3 on: August 30, 2018, 02:25:25 pm »
..
=(IF(E10="",,(IF(E10>D10,E10-D10,((1-D10)+E10))*24)) )
H10 shows now nothing.(It should show 13,00)
...
I found this error. It calculates 00:00 as nothing.
Change this formula to:
=(IF(E10="",999,(IF(E10>D10,E10-D10,((1-D10)+E10))*24)) )
then it will show 999.

Soner

  • Sr. Member
  • ****
  • Posts: 305
Re: fpspreadshet calculates wrong when the time is 00:00
« Reply #4 on: August 30, 2018, 02:37:01 pm »
really fpspreadsheet calculates 00:00 as nothing when the cell is time field.
Look the formula at C40. It shows 2, because only the cells E12 and E12 has different value then 00:00.

« Last Edit: August 30, 2018, 02:39:55 pm by Soner »

Soner

  • Sr. Member
  • ****
  • Posts: 305
Re: fpspreadshet calculates wrong when the time is 00:00
« Reply #5 on: August 30, 2018, 02:51:25 pm »
@wp:
Wrong calculation is caused only by 00:00. -7 is the pause part, because first part results 0 and 0-7 is -7.
Change this:
=(IF(E10="",,(IF(E10>.....
to
=(IF(E10="",10,(IF(E10>.....
then you get 3.


Soner

  • Sr. Member
  • ****
  • Posts: 305
Re: fpspreadshet calculates wrong when the time is 00:00
« Reply #6 on: August 30, 2018, 05:04:16 pm »
If found another error.
When you compare string value with a time or number formatted cells then you get sometimes wrong value.
Look the formulat at the cells N43 and N44 from attached file.

Soner

  • Sr. Member
  • ****
  • Posts: 305
Re: fpspreadshet calculates wrong when the time is 00:00
« Reply #7 on: August 30, 2018, 05:21:26 pm »
If found again an error.
When one sheet contains link to other sheet and you save it as ods-format the you can't open it with fpspreadsheet. But LibreOffice can open it.
I have 2 files in attachment, i created them with my program as xlsx-format and as ods-format. Spready can open the file xlsx-format but it can not open ods-format.
Now when you open ods-file in libreoffice and delete the liste-sheet then spready can open it, because liste-sheet contains formula with link to other sheet.

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: fpspreadshet calculates wrong when the time is 00:00
« Reply #8 on: August 30, 2018, 05:38:38 pm »
fpspreadshet calculates wrong when the time is 00:00.
Fixed in ccr-r6627. The problem was that an empty cell was considered in a comparison operation to have the value 0.
« Last Edit: August 30, 2018, 07:50:48 pm by wp »

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: fpspreadshet calculates wrong when the time is 00:00
« Reply #9 on: August 30, 2018, 07:49:43 pm »
When one sheet contains link to other sheet and you save it as ods-format the you can't open it with fpspreadsheet. But LibreOffice can open it.
Fixed in ccr-c6629. Here the problem was that ODS quotes sheets reference in addition to the square backets that they always put around the sheetnames. In addition there is also a '$' in front of the quoted sheet names. Seems like overkill to me. But should work now.

Soner

  • Sr. Member
  • ****
  • Posts: 305
Re: fpspreadshet calculates wrong when the time is 00:00
« Reply #10 on: August 31, 2018, 11:34:34 am »
Thanks, it works, you are great!
LibreOffice developer can learn something from you.

 

TinyPortal © 2005-2018