Fix dragged formula multiple axes#566
Conversation
|
Let me know what your preference for tests is. |
|
I fixed the failing typo check on master. If you rebase to that it will fix the failing CI check. |
1f097f8 to
41d75b8
Compare
|
rebased |
|
Could you add test case(s) for the second commit: "Handle non-monotonic si number". |
f0308be to
0c7afb3
Compare
|
Hi sorry for the delay. |
|
btw once you're happy with the pr, I'll do |
I would prefer to see the fixups merged into the the commits they were fixing but perhaps you did it that way to make it clearer for review. Either way it isn't a big issue. I will need another couple of days to review these fully but thanks for the work. |
Yeah, my normal workflow is to address fixes to commits by running I'll just push the updated commits in future.
Great thanks! |
This may be a stupid question but I'm struggling to understand the "monotonic" condition from the test case: // This excel has been manually edited so that the si numbers do not monotonically increase (si
// 0 swapped with 1)Where is that happening? |
|
Also, could you check if the following condition is handled before/after the changes and add it as a test case if required. Sheet1 has a standard shared formula in cell "B1" as "=A1". This is shared down to cell "B5". <sheetData>
<row r="1" spans="1:2" x14ac:dyDescent="0.2">
<c r="A1">
<v>1</v>
</c>
<c r="B1">
<f>A1</f>
<v>1</v>
</c>
</row>
<row r="2" spans="1:2" x14ac:dyDescent="0.2">
<c r="A2">
<v>2</v>
</c>
<c r="B2">
<f t="shared" ref="B2:B5" si="0">A2</f>
<v>2</v>
</c>
</row>
<row r="3" spans="1:2" x14ac:dyDescent="0.2">
<c r="A3">
<v>3</v>
</c>
<c r="B3">
<f t="shared" si="0"/>
<v>3</v>
</c>
</row>
<row r="4" spans="1:2" x14ac:dyDescent="0.2">
<c r="A4">
<v>4</v>
</c>
<c r="B4">
<f t="shared" si="0"/>
<v>4</v>
</c>
</row>
<row r="5" spans="1:2" x14ac:dyDescent="0.2">
<c r="A5">
<v>5</v>
</c>
<c r="B5">
<f t="shared" si="0"/>
<v>5</v>
</c>
</row>
</sheetData>Sheet2 has a shared formula in cell "B5" as "=A5". This is shared "up" to cell "B1". <sheetData>
<row r="1" spans="1:2" x14ac:dyDescent="0.2">
<c r="A1">
<v>1</v>
</c>
<c r="B1">
<f t="shared" ref="B1:B4" si="0">A1</f>
<v>1</v>
</c>
</row>
<row r="2" spans="1:2" x14ac:dyDescent="0.2">
<c r="A2">
<v>2</v>
</c>
<c r="B2">
<f t="shared" si="0"/>
<v>2</v>
</c>
</row>
<row r="3" spans="1:2" x14ac:dyDescent="0.2">
<c r="A3">
<v>3</v>
</c>
<c r="B3">
<f t="shared" si="0"/>
<v>3</v>
</c>
</row>
<row r="4" spans="1:2" x14ac:dyDescent="0.2">
<c r="A4">
<v>4</v>
</c>
<c r="B4">
<f t="shared" si="0"/>
<v>4</v>
</c>
</row>
<row r="5" spans="1:2" x14ac:dyDescent="0.2">
<c r="A5">
<v>5</v>
</c>
<c r="B5">
<f>A5</f>
<v>5</v>
</c>
</row>
</sheetData> |
Just to confirm the shared formula is still "above/before" the range it "shares" to (as is the case in the XML you gave)? I've added it as a test case and it seems to pass fine. |
So essentially I had a normal Excel with 3 formulas and they were given si numbers 0, 1 and 2. I then manually swapped everywhere I saw si=0 referenced with 1 and visa-versa. In the old code the si numbers were required to only ever increase in the order that they were parsed. If you had an si number less than the current max, it would be pushed to the end and would have the wrong index breaking any cells that reference it (they would probably just point to a I have no idea if this happens in practise but I noticed the code when I was fixing the other issue, and it seemed like an easy change to cover some potential edge cases. I did take a look at the spec and I couldn't find anything one way or the other so it seems like it's not guaranteed that the si number only every increases throughout a sheet. |
So this is the bit I'm missing. I expected to see something like that in the test file but the <sheetData>
<row r="1" spans="1:3" x14ac:dyDescent="0.2">
<c r="A1">
<v>1</v>
</c>
<c r="B1">
<v>2</v>
</c>
<c r="C1">
<v>3</v>
</c>
</row>
<row r="2" spans="1:3" x14ac:dyDescent="0.2">
<c r="A2">
<f>A1+1</f>
<v>2</v>
</c>
<c r="B2">
<f>B1+2</f>
<v>4</v>
</c>
<c r="C2">
<f>C1+3</f>
<v>6</v>
</c>
</row>
<row r="3" spans="1:3" x14ac:dyDescent="0.2">
<c r="A3">
<f t="shared" ref="A3:A6" si="0">A2+1</f>
<v>3</v>
</c>
<c r="B3">
<f t="shared" ref="B3:B6" si="1">B2+2</f>
<v>6</v>
</c>
<c r="C3">
<f t="shared" ref="C3:C6" si="2">C2+3</f>
<v>9</v>
</c>
</row>
<row r="4" spans="1:3" x14ac:dyDescent="0.2">
<c r="A4">
<f t="shared" si="0"/>
<v>4</v>
</c>
<c r="B4">
<f t="shared" si="1"/>
<v>8</v>
</c>
<c r="C4">
<f t="shared" si="2"/>
<v>12</v>
</c>
</row>
<row r="5" spans="1:3" x14ac:dyDescent="0.2">
<c r="A5">
<f t="shared" si="0"/>
<v>5</v>
</c>
<c r="B5">
<f t="shared" si="1"/>
<v>10</v>
</c>
<c r="C5">
<f t="shared" si="2"/>
<v>15</v>
</c>
</row>
<row r="6" spans="1:3" x14ac:dyDescent="0.2">
<c r="A6">
<f t="shared" si="0"/>
<v>6</v>
</c>
<c r="B6">
<f t="shared" si="1"/>
<v>12</v>
</c>
<c r="C6">
<f t="shared" si="2"/>
<v>18</v>
</c>
</row>
</sheetData> |
Yes.
Great. Thanks. |
That's odd that's not what I see: |
|
Ahh I just did a test. I opened the file in Excel and saved and it re-ordered the si numbers. It looks like my version of excel fixes the order on save. |
Apologies. I must have resaved it in that case. Sorry for the noise. The test case make more sense now. Otherwise this looks good to merge. Can you squash the fixup test cases into the relevant commits and resubmit the PR and I will merge it. |
The spec doesn't guarantee that the si number monotonically increases, so this handles that by allowing an earlier si number to be overwritten.
b349d19 to
0d1af13
Compare
No worries :)
Done |
|
once it's merged, I'll rebase my other PR off master and then that should be ready for a review |
|
Merged. Thanks.
Sounds good. |
Fixes #565