[Libreoffice-bugs] [Bug 107779] New: Sorting breaks rows data alignement when functions include columns with no data

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Thu May 11 17:21:09 UTC 2017


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

            Bug ID: 107779
           Summary: Sorting breaks rows data alignement when functions
                    include columns with no data
           Product: LibreOffice
           Version: 5.3.3.2 release
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: pp.luca at tiscali.it

In Tools / Options / LibreOffice Calc / General
select:

[X] Update references when sorting range of cells.


1) Setup a Calc spreadsheet this way:

      A             B          C        D

1     a       =sum(C1:D1)      1        1
2     b       =sum(C2:D2)      2        2
3     c       =sum(C3:D3)      3        3


This way a is worth 2, b is worth 4, c is worth 6, you see:

      A             B            C        D

1     a             2            1        1
2     b             4            2        2
3     c             6            3        3

2) Now select all then sort by column A descending using Data / Sort. You see,
as expected:

      A             B            C        D

1     c             6            3        3
2     b             4            2        2
3     a             2            1        1


3) Now revert to original sorting (ctrl+z), then modify function in B, as to
include column E - which doesn't contain data - in the sum:

      A             B            C        D

1     a       =sum(C1:E1)      1        1
2     b       =sum(C2:E2)      2        2
3     c       =sum(C3:E3)      3        3

The result is the same as in 1, as expected.

4) Now repeat 2): select all then sort by column A descending using Data /
Sort. You get the wrong result in column B:

      A             B            C        D

1     c             2            3        3
2     b             4            2        2
3     a             6            1        1

That's because the references in column B have been wrongfully reordered,
following column A but ignoring C and  D:

      A             B            C        D

1     c       =somma(C3:E3)      3        3
2     b       =somma(C2:E2)      2        2
3     a       =somma(C1:E1)      1        1


5) If (step 3) you add any value in column D, then repeat step 2), sorting
order is correct. That's to say, starting from:

      A             B            C        D       E

1     a       =somma(C1:E1)      1        1
2     b       =somma(C2:E2)      2        2
3     c       =somma(C3:E3)      3        3       3

The descending order on column A produces, as expected:

      A             B            C        D       E

1     c             9            3        3       3
2     b             4            2        2
3     a             2            1        1

=================================================================

This is bad. And it's not the only case when Calc breaks the raws integrity
without any warning. Also see bug # 107385:
https://bugs.documentfoundation.org/show_bug.cgi?id=107385

--

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20170511/c4f72cb3/attachment.html>


More information about the Libreoffice-bugs mailing list