Bug 87678 - Formula calculates data from the row below that programmed (hard recalc needed)
Summary: Formula calculates data from the row below that programmed (hard recalc needed)
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected) rc
Hardware: All All
: medium major
Assignee: Not Assigned
Keywords: bibisected, bisected, regression
Depends on:
Reported: 2014-12-24 11:00 UTC by JackS
Modified: 2015-12-15 22:15 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:

Register of work time for team members (one person on one sheet). (81.60 KB, application/vnd.oasis.opendocument.spreadsheet)
2014-12-24 11:00 UTC, JackS

Note You need to log in before you can comment on or make changes to this bug.
Description JackS 2014-12-24 11:00:34 UTC
Created attachment 111270 [details]
Register of work time for team members (one person on one sheet).

In attached file on sheet "Marta Borowiec" in column E shuld be calculated time of work (formula simply subtracts col.D-C in the same row).
In row 5 I manually corected formulas by retyping THE SAME FORMULA : E5=D5-C5 
But in row 6 till 50 cells are not edited. Results are calculated from rows below (offset?). Using F9 or recalculate function from menu or saving and closing file - doesn't affect the result.
Comment 1 m_a_riosv 2014-12-24 17:03:50 UTC
Hi @JackS, thanks for reporting.

I can reproduce with your version even with:
Build ID: aeeff83595a176805d74ad4e35d946eb6a8e1b25
TinderBox: Win-x86@42, Branch:master, Time: 2014-12-22_23:20:12

Fortunately seems that a hard recalc [Ctrl+Shif+F9] does right calculations.

You can set up in Menu/Options/LibreOffice calc/Formula/Recalculation on file load - ODS spreadsheets - Always.
Comment 2 raal 2014-12-28 17:41:02 UTC
I can confirm with LO 4.3.3, Version:
Build ID: 7f476fea47f06a7f8cc961dd4f6595a524346fa5
TinderBox: Linux-rpm_deb-x86_64@46-TDF, Branch:master, Time: 2014-12-27_23:36:28

Works correct with LO 3.5, regression. Setting as NEW.
Comment 3 Michael Weghorn 2015-01-11 00:35:10 UTC
bibisect result:

# bad: [423a84c4f7068853974887d98442bc2a2d0cc91b] source-hash-c15927f20d4727c3b8de68497b6949e72f9e6e9e
# good: [65fd30f5cb4cdd37995a33420ed8273c0a29bf00] source-hash-d6cde02dbce8c28c6af836e2dc1120f8a6ef9932
git bisect start 'latest' 'oldest'
# bad: [e02439a3d6297a1f5334fa558ddec5ef4212c574] source-hash-6b8393474974d2af7a2cb3c47b3d5c081b550bdb
git bisect bad e02439a3d6297a1f5334fa558ddec5ef4212c574
# bad: [8f4aeaad2f65d656328a451154142bb82efa4327] source-hash-1885266f274575327cdeee9852945a3e91f32f15
git bisect bad 8f4aeaad2f65d656328a451154142bb82efa4327
# good: [369369915d3582924b3d01c9b01167268ed38f3b] source-hash-45295f3cdceb4c289553791071b5d7f4962d2ec4
git bisect good 369369915d3582924b3d01c9b01167268ed38f3b
# good: [6fce03a944bf50e90cd31e2d559fe8705ccc993e] source-hash-47e4a33a6405eb1b5186027f55bd9cb99b0c1fe7
git bisect good 6fce03a944bf50e90cd31e2d559fe8705ccc993e
# bad: [da317333e5675622f55c9dda17396c659af65320] source-hash-15af925c254f27046427de70a59011e2ac3d6bdb
git bisect bad da317333e5675622f55c9dda17396c659af65320
# good: [daa21bbd8c7b50e2ca1c2cbed0e39f0e7b5a1cb2] source-hash-6b11a18071254a443c8fe7e7b0b1c95b0f9fd35e
git bisect good daa21bbd8c7b50e2ca1c2cbed0e39f0e7b5a1cb2
# good: [a08143f4bae3d6658dd756b42b6f343298d1f48c] source-hash-b7822657fa67e7265d07f5852057e975e9efae0d
git bisect good a08143f4bae3d6658dd756b42b6f343298d1f48c
# good: [5255e1fbf1f3fa3ca61c4db3005940205577863c] source-hash-63c004fc3f0bc53ce888ef012f7993b9203a7503
git bisect good 5255e1fbf1f3fa3ca61c4db3005940205577863c
# bad: [7be7cf83087144563a18000acdae82c8fd6f4872] source-hash-d59024b652ccfaf7247da113ec36788fe260de74
git bisect bad 7be7cf83087144563a18000acdae82c8fd6f4872
# good: [ad874a5319e9f68e6b3a974e44de838b8a0a82e1] source-hash-4b4ca8030285bd66526ff5bb2b6ea5a75a6c6bc7
git bisect good ad874a5319e9f68e6b3a974e44de838b8a0a82e1
# first bad commit: [7be7cf83087144563a18000acdae82c8fd6f4872] source-hash-d59024b652ccfaf7247da113ec36788fe260de74
Comment 4 Matthew Francis 2015-01-12 02:26:14 UTC
This seems to be the result of a bug being fixed, rather than being a bug itself.

The last calculated value of a cell is stored in the .ods, and in this case it appears that the stored value in the .ods is what is wrong. What has happened here is that we started paying attention to the stored value properly, rather than always recalculating on every load (for a large spreadsheet, this can save a lot of time).

After forcing a recalculate (Ctrl+Shift+F9), the values save and load correctly every time with versions after the change, so there is no bug remaining.


For reference, the commit which changed the behaviour (correctly) is this one:

commit 1cdfb19c2202b56e4de6f10104bb4841372956cb
Author: Daniel Bankston <daniel.e.bankston@gmail.com>
Date:   Tue Jul 3 03:06:29 2012 -0500

    Use imported formula results if ODS doc was generated by LibreOffice
    During ODS import, use imported formula results instead of recalculating if
    the document was generated by LibreOffice.
    Still need to implement recalculating special cases such as NOW().
    Change-Id: Ia54690224dc0d8f74b93cafd8d01b072e85c7416
Comment 5 Robinson Tryon (qubit) 2015-12-15 22:15:50 UTC
Migrating Whiteboard tags to Keywords: (bibisected regression)