Bug 104350

Summary: EDITING unexpected result of sum with merged cells
Product: LibreOffice Reporter: heringer <emerson.br>
Component: CalcAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED NOTABUG    
Severity: normal CC: miguelangelrv
Priority: medium    
Version: 5.2.0.4 release   
Hardware: x86-64 (AMD64)   
OS: Windows (All)   
Whiteboard:
Crash report or crash signature: Regression By:

Description heringer 2016-12-02 11:00:49 UTC
Editing Calc: unexpected result of sum with merged cells
Version 5.2.0.4
Build ID: 066b007f5ebcc236395c7d282ba488bca6720265
Windows 10
pt-BR

1) New Spreadsheet.
2) Set A1 = 1000.
3) Set A2 = 1000.
4) Set A3 = 1000.
5) Set A4 = SUM(A1:A3). Notice that the result is 3000.
6) Select A2 and A3.
7) Click on "merge and center cells".
8) Answer "No" to "Should the contents of the hidden cells be moved into the first cell?".
9) Notice that the result of the sum in cell A4 is still 3000.
10) Change the merged cell (A2 with A3) value to zero.
11) Notice that the result of the sum in cell A4 is 2000.

This is unexpected. It took me a lot to find out why a sum was "incorrect" in a sheet.

Another way to see unexpected behaviour (considering the final scenario from the previous example):
1) Right click bottom status bar and change it to show the sum.
2) Hold ctrl and click on A1 and then click on merged cell.
3) Notice the sum is 1000, wich is expected.
4) Remove selection.
5) Hold shift and click on A1 and then click on merged cell.
6) Notice the sum is 2000, wich is unexpected.
Comment 1 m_a_riosv 2016-12-03 16:27:15 UTC
There are new options for merge cells with 5.3 https://wiki.documentfoundation.org/ReleaseNotes/5.3#Other so you can empty the hidden cells at merge.

But for now there is no error, when you merge and select "No" A3 keeps their value.
Comment 2 heringer 2016-12-07 18:10:19 UTC
Sounds like a dangerous behaviour to me. I spent a lot of time trying to understand what was going on.

Anyways, i think this bug should be marked as duplicate of the bug 30456. I did not that one in my previous search, but i saw it in the link you posted.

https://bugs.documentfoundation.org/show_bug.cgi?id=30456