Bug 121436

Summary: CALC editing: Shifting Cells when inserting a cut column breaks formulas after the cut column
Product: LibreOffice Reporter: NISZ LibreOffice Team <libreoffice>
Component: CalcAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: normal CC: erack, kelemeng, nemeth, oliver.brinzing, raal, shinji.enoki, xiscofauli
Priority: medium    
Version: 4.1 all versions   
Hardware: All   
OS: All   
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 108253, 108364    
Attachments: The file to reproduce the issue. [it's not, it just is a copy of the bug description as text .odt file]
A screenshot showcasing the issue.
The file to reproduce the issue.

Description NISZ LibreOffice Team 2018-11-15 09:20:05 UTC
Description:
When a whole column is cut from a spreadsheet and pasted into a different column with the other cells shifted to the right, formulas that are located right from the original location of the cut column break.

This bug needs specific circumstances to occur:
- The cells should be referenced without a function, so the bug only occurs when the cells are referenced like =A1+B1+C1, but not when they are referenced like =SUM(A1:C1);
- The bug doesn't occur either if a new column is inserted to the intended location manually with the Insert Columns Left command and the content is inserted into this newly created column;
- Another way to avoid the bug is to insert a new column to the intended location manually with the Insert Columns Left command, then Undo it with Ctrl+Z, and then insert the content with Paste Special – Shift Cells: Right.

Steps to Reproduce:
1. Add a number to the A1 cell
2. Add a number to the B1 cell
3. Add a formula to the C1 cell that references the A1 and B1 cells (e.g.: =A1*B1)
4. Type in some text in the D1 cell
5. Reference the A1, B1 and C1 cells from the E1 cell (e.g.: =A1+B1+C1)
6. Click to the top of the D column to select the whole column and press Ctrl+X
7. Click on the B column and press Ctrl+Shift+V
8. In the Paste Special window select “Paste all” at Selection, and “Right” at Shift Cells, then press OK.


Actual Results:
In the E1 cell the reference pointing to the B1 cell doesn't get updated to C1 breaking the formula.

Expected Results:
The reference in the E1 cell should be updated to the new location.


Reproducible: Always


User Profile Reset: No



Additional Info:
Comment 1 NISZ LibreOffice Team 2018-11-15 09:20:45 UTC Comment hidden (obsolete)
Comment 2 NISZ LibreOffice Team 2018-11-15 09:21:00 UTC
Created attachment 146654 [details]
A screenshot showcasing the issue.
Comment 3 Xisco Faulí 2018-11-15 12:18:27 UTC
Reproduced in

Version: 6.2.0.0.alpha1+
Build ID: db01b26d2e7d6626b7504fc7ee6ba6aac50e6098
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
Calc: threaded

Version: 5.2.0.0.alpha0+
Build ID: 3ca42d8d51174010d5e8a32b96e9b4c0b3730a53
Threads 4; Ver: 4.10; Render: default; 

Version: 4.3.0.0.alpha1+
Build ID: c15927f20d4727c3b8de68497b6949e72f9e6e9e

Version 4.1.0.0.alpha0+ (Build ID: efca6f15609322f62a35619619a6d5fe5c9bd5a)
Comment 4 Xisco Faulí 2018-11-15 12:18:50 UTC
@Eike, I thought you could be interested in this issue...
Comment 5 NISZ LibreOffice Team 2018-11-16 07:22:08 UTC
Created attachment 146680 [details]
The file to reproduce the issue.
Comment 6 QA Administrators 2019-11-19 03:28:46 UTC Comment hidden (obsolete)
Comment 7 Oliver Brinzing 2019-11-19 08:02:30 UTC
reproducible with:

Version: 6.3.3.2 (x64)
Build-ID: a64200df03143b798afd1ec74a12ab50359878ed
CPU-Threads: 4; BS: Windows 10.0; UI-Render: Standard; VCL: win; 
Gebietsschema: de-DE (de_DE); UI-Sprache: de-DE
Calc: 

Version: 6.5.0.0.alpha0+ (x64)
Build ID: d04eef858250f97690f32dba17f42d157a8767fc
CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: default; VCL: win; 
Locale: de-DE (de_DE); UI-Language: en-US
Calc: threaded

Formula in E1 (-> F1 after shifting right) points to: =A1+C1+B1 and results to #VALUE
Comment 8 QA Administrators 2021-11-19 05:18:09 UTC Comment hidden (obsolete)
Comment 9 QA Administrators 2023-11-20 03:11:42 UTC Comment hidden (obsolete)
Comment 10 Saburo 2024-06-08 03:28:28 UTC
reproduce

It seems that when the cell address in the formula is shifted to the cell address where the cut was made, it is corrected to the cell address where the paste was made.

https://ask.libreoffice.org/t/topic/106010/9

copy+pastespacial(shift) not repro
alt+drag not repro

Version: 24.8.0.0.alpha1 (X86_64) / LibreOffice Community
Build ID: a17e39caaf73108bee692d6f64a44c62f4066f1d
CPU threads: 12; OS: Windows 11 X86_64 (10.0 build 22631); UI render: Skia/Raster; VCL: win
Locale: ja-JP (ja_JP); UI: ja-JP
Calc: CL threaded
Comment 11 TANAKA Hidemune 2024-06-10 11:46:32 UTC
There is no consistency in following absolute references

Shifting rows or columns may or may not change the references as expected. For more information, see the Japanese Ask.

https://ask.libreoffice.org/t/topic/106010
Comment 12 Shinji Enoki 2024-06-10 11:53:16 UTC
Reproduced in

Version: 24.2.3.2 (X86_64) / LibreOffice Community
Build ID: 433d9c2ded56988e8a90e6b2e771ee4e6a5ab2ba
CPU threads: 4; OS: Linux 5.10; UI render: default; VCL: gtk3
Locale: ja-JP (ja_JP.UTF-8); UI: ja-JP
Calc: threaded

The case discussed in Japanese ASK used absolute references, so the situation may be a little different, but there were problems even with absolute references.