Bug 84652 - References to a range are not properly updated if it's not moved the whole referenced range
Summary: References to a range are not properly updated if it's not moved the whole re...
Status: CLOSED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: Other All
: medium major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-04 07:25 UTC by suradetj
Modified: 2017-04-25 13:21 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Sample of bug (13.32 KB, application/vnd.oasis.opendocument.spreadsheet)
2014-10-04 07:25 UTC, suradetj
Details

Note You need to log in before you can comment on or make changes to this bug.
Description suradetj 2014-10-04 07:25:47 UTC
Created attachment 107311 [details]
Sample of bug

Reproduce

1. Select cells C5:S5
2. Cut and paste the cells to another location

The first cell (was named Total) displays 0.

Temporary workaround.
1. Undo the paste
2. Redo the paste

This behavior was not there in version 4.3.1
Comment 1 m_a_riosv 2014-10-04 11:16:50 UTC
With Cut&Paste the formula doesn't change what it's right, moves the range to a new place. Only Copy adapts relative address parts of the formula.

Works fine for me with
Win7x64
Version: 4.3.2.1
Build ID: f9b3ad49d92181b0a1fe7e76f785a2c2cd0847d3

1. "Total" is the name of address C5
C5: =SUM(D5:ZV5) (value 100) 
2. Select cells C5:S5
3. Cut and paste the cells to C10
4. "Total" is now the name of address C10 (Ok)
C10: =SUM(D5:ZV5) (value 0) (Ok)

5. Select cells C5:S5
6. Copy and paste the cells to C10
7. "Total" remains as the name of address C5 (Ok)
C10: =SUM(D10:ZV10) (value 100) (Ok)

Resolved as NOTABUG, please if you are not agree reopen it.
Comment 2 suradetj 2014-10-04 14:40:58 UTC
Thank you very much for quick reply.

I believe this is a bug.   Since in previous versions, the cut and paste should also adapt to relative address parts of the formula.

I also experiment with different cell locations on the same file I attached earlier.

1. Put 1 to 5 on Cell C2:G2
2. Enter the formula sum(C2:G2) in B2 (B2 is now value 15)
3. Assign the name AnotherTotal to B2
4. Select cells B2:G2
5. Cut and paste on cell B10
6. The name AnotherTotal is now B10 and the formula is now sum(C10:G10) the value is 15 (The cut and paste on the same sheet now adapt to the relative address parts of the formula.
Comment 3 m_a_riosv 2014-10-05 00:21:26 UTC
First thanks for your persistence, I think indeed there is a bug.

(In reply to suradetj from comment #2)
.....
> I believe this is a bug.   Since in previous versions, the cut and paste
> should also adapt to relative address parts of the formula.
Cut&Paste doesn't use relative/absolute address, it's must adapt addresses in cells with references to the moved range.
......
> 1. Put 1 to 5 on Cell C2:G2
......
> 6. The name AnotherTotal is now B10 and the formula is now sum(C10:G10) the
> value is 15 (The cut and paste on the same sheet now adapt to the relative
> address parts of the formula.
This case works because the whole referenced cells are moved, C2:G2 is in B2:G2.

What's the bug?:

C5: =SUM(D5:ZV5) (value 100) 
1. Select cells C5:S5
2. Cut and paste the cells to C10
C10: =SUM(D5:ZV5) (value 0) NOT Ok
It must be: =SUM(D10:ZV5)

The beginning of the SUM() address "D5" is inside the moved range, so it should be adapted as D10.
The end of the SUM() address "ZV5" is outside the moved range, so it must not change as it's happen.

The bug is inherited from OpenOffice, the same happens with AOO 4.1.1
Works fine with Lotus 123.

"References to a range are not properly updated if it's not moved the whole referenced range."

To reproduce in a new spredsheet:

A1: =SUM(B1:D1)       Cut&Paste B1 to B2
A1: =SUM(B1:D1) not Ok it must be =SUM(B2:D1)

A1: =SUM(B1:D1)      Cut&Paste D1 to D2
A1: =SUM(B1:D1) not Ok it must be =SUM(B1:D2)

A1: =SUM(B1:D1)      Cut&Paste B1:D1 to B2
A1: =SUM(B2:D2) Ok

Please @suradetj change the title for one relative to the real bug, the cell names have nothing to do.
Comment 4 suradetj 2014-10-05 15:47:03 UTC
I have slightly different opinion on the result.  I think that partial move should result to error instead.

I also test this behavior on Excel 2003, Excel 2013, and Google Spreadsheet, Quattro Pro X7, WPS Office (KingSoft Office).

The behaviors are
1. References to a range are not properly updated if it's not moved the whole referenced range (Current behavior of LibreOffice and Apache OpenOffice).  Software with this behavior are
 - Excel 2003
 - Excel 2013
 - Google Spreadsheet
 - WPS Office

2. References are updated to cover the original range and the moved range (As indicated as a bug). Software with this behavior are
  - Quattro Pro X7
  - Lotus 123 (As indicated above)

3. My proposal is The move should cause error in the referring cell as the range are now changed.
Comment 5 klsu 2014-12-21 19:09:20 UTC
This may be the same problem:

in cell C1 enter 1
in cell C2 enter =$C$1+C1
select cell C2
Copy
select range C3:C40
Paste
select range C21:C40
Cut
select any cell in any other column
Paste
Comment 6 tommy27 2016-04-16 07:23:41 UTC Comment hidden (obsolete)
Comment 7 Eike Rathke 2017-04-25 13:21:11 UTC
If not the entire range a formula expression references is moved (Cut&Paste) then the reference is not adjusted to a new position, i.e. moving only C5:S5 the reference D5:ZV5 in C5 stays D5:ZV5. This is normal behaviour implemented by all major spreadsheet applications, as also comment 4 indicates.