Bug 93202 - When merging cells formula is lost
Summary: When merging cells formula is lost
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.4.5.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: dataLoss
: 136405 153355 (view as bug list)
Depends on:
Blocks: Cell-Formula Calc-Merge-Split
  Show dependency treegraph
 
Reported: 2015-08-06 15:23 UTC by grofaty
Modified: 2023-03-16 17:48 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample ODS (8.01 KB, application/vnd.oasis.opendocument.spreadsheet)
2020-11-09 09:47 UTC, Timur
Details

Note You need to log in before you can comment on or make changes to this bug.
Description grofaty 2015-08-06 15:23:58 UTC
LibreOffice 5.0.0.5 on Ubuntu 14.04 using PPA: http://ppa.launchpad.net/libreoffice/ppa/ubuntu

1. Open new Calc document.
2. In cell A1 type in value: 100
3. In cell A2 type in value: 200
4. In Cell B1 type in formula: =sum(A1:A2)
5. Click on B1 cell, press Shift key and click on B2 cell. Now both B1 and b2 cells are selected.
6. Click on "Merge and Center Cells" to merge selected cells (B1 and B2). Works fine.
7. In Cell C2 type in formula: sum(A1:A2)
8. Click on C2 cell, press Shift key and click on C1 cell. Now both C2 and C1 cells are selected.
9. Click on "Merge and Center Cells" and now dialog opens with question: "Should the contents of hidden cells be movied into the first cell?" with Yes/No/Cancel options.
10.
a) Pressing Cancel, merge is canceled. Works fine.
b) Pressing No, cells are merged and all content lost. Works fine.
c) Pressing Yes, and value "300" is copied from C2 into cell C1. This is not fine.
I expect to formula in C2 to be copied into C1, so after pressing Yes I expect to have formula =sum(A1:A2) present in cell C1. But it looks like value is copied instead of formula. In my humble opinion step 6 and step 9 should result in the same state, having formula in cell after merge.

P.S. If you think this is not a bug, then at least there should be this bug marked as "enhancement".
Comment 1 grofaty 2015-08-06 15:34:12 UTC
I did additional test: If B2 and C1 has some formula in it like =average(A1:A2), then content from both cells (not formula) is concatenated into single string value. This is somehow logical, two formulas can't be merged into single cell, content can be.

But in case of merging "formula" and "empty cell" like in above 6 and 9 steps, I still expect to have formula copied in BOTH cases.
Comment 2 raal 2015-08-06 16:18:28 UTC
Reproducible with Version: 5.1.0.0.alpha1+ (x64)
Build ID: e92a8b92072284fd7c37d7bb3e1e8fe72a185f35
TinderBox: Win-x86_64@62-TDF, Branch:MASTER, Time: 2015-07-22_21:46:26
Comment 3 grofaty 2015-08-07 05:07:13 UTC
Now I have also tested on LibreOffice v4.4.5.2 and there is the same problem, so NOT a 5.0.x regression.
Comment 4 QA Administrators 2016-11-08 11:06:04 UTC Comment hidden (obsolete)
Comment 5 grofaty 2016-11-23 13:00:35 UTC
Hi,
I have retested the problem in LibreOffice master on Windows 7 and the problem remains. What I see steps 9 and 10 is little bit different, because it looks like dialog has changed.

At step 10 I expect when selecting "Move the contents of the hidden cels into the first cell" (so merging formula and empty cell) formula should move to the merged cell, but now just text "300" gets displayed.

==============
MASTER VERSION
==============
Version: 5.3.0.0.alpha1+
Build ID: f965a629fba10ecba7bad938a0c1c9c3db1e510d
CPU Threads: 3; OS Version: Windows 6.1; UI Render: default; Layout Engine: new; 
TinderBox: Win-x86@62-merge-TDF, Branch:MASTER, Time: 2016-11-23_00:13:10
Locale: sl-SI (sl_SI); Calc: group
Comment 6 QA Administrators 2018-06-04 02:34:25 UTC Comment hidden (obsolete)
Comment 7 grofaty 2018-06-05 05:12:19 UTC Comment hidden (obsolete)
Comment 8 raal 2018-06-11 20:05:03 UTC
I can still reproduce with 6.0.4.2 (x64); windows and Version: 6.2.0.0.alpha0+
Build ID: c4c56de1b0e62ec866b519b2b24c5e805f0a86d3
CPU threads: 4; OS: Linux 4.4; UI render: default; VCL: gtk3; 

Setting back to New. Now it's without dialog Yes/No, but result is number and not the formula.
Comment 9 grofaty 2018-06-12 05:13:53 UTC
I have retested on the same version as in Comment 7 and it works exactly as raal described in Comment 8. Sorry for confusion. Problem is not solved, just changed its behaving (no more Yes/No/Cancel button), value displayed and formula is lost.
Comment 10 QA Administrators 2019-06-13 03:00:59 UTC Comment hidden (obsolete)
Comment 11 Timur 2020-11-09 09:47:05 UTC
Created attachment 167114 [details]
Sample ODS

With LO 7.1+ repro per Comment 8. 
For easier test, I attach sample ODS.
Just merge C1 and C2 and see formula lost, just vale kept. 

But I see this as a duplicate of 89951.
What happens is that format/formula is lost and value kept. 
Doesn't happen if merged C2 and C3.
Comment 12 Timur 2020-11-09 09:47:24 UTC

*** This bug has been marked as a duplicate of bug 89951 ***
Comment 13 Stéphane Guillou (stragu) 2023-03-16 17:41:37 UTC
I think this should be kept separate to the formatting issue.

The formula issue is a dataloss issue, and the user might not notice that the formula was converted to a static value, invalidating calculations throughout the sheet. More serious than the formatting problem.

Reproduced in:

Version: 7.5.1.2 (X86_64) / LibreOffice Community
Build ID: fcbaee479e84c6cd81291587d2ee68cba099e129
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded
Comment 14 Stéphane Guillou (stragu) 2023-03-16 17:42:00 UTC
*** Bug 136405 has been marked as a duplicate of this bug. ***
Comment 15 Stéphane Guillou (stragu) 2023-03-16 17:48:37 UTC
*** Bug 153355 has been marked as a duplicate of this bug. ***