bug in sorting?



Hello all,

When sorting moves a row, it seems to correctly rewrite references
within that row, but mix up references to other rows which the sort
moves. This is 1.12.18 on Ubuntu 15.04.

Consider this spreadsheet, in something like CSV format:

a, 5
b, 6
c, 7
d, 8

Enter this formula for C1:

=B1/$B$1

Then copy that down to C4 by dragging on the corner, so you have:

a, 5, 1
b, 6, 1.2
c, 7, 1.4
d, 8, 1.6

Now edit the formula for C3 to be:

=B3/B2

So you have:

a, 5, 1
b, 6, 1.2
c, 7, 1.166667
d, 8, 1.6

Now select the area A1:C4, click Data / Sort, and sort on column C. I
would expect rows b and c to swap over and for their two column C
expression to be rewritten appropriately, instead you see:

a, 5, 1
c, 7, 1.4
b, 6, 1.2
d, 8, 1.6

So the rows have been swapped but the formula have not all been
rewritten correctly, so the data is not sorted by column C. If you
look at the row c expression (now in cell C2) you see:

=B2/B1

So the numerator (the reference within the row) has been correctly
rewritten, but the denominator now refers to B1, I'm not sure why. I
think it should have been changed to B3.

John


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]