Calc is unable to resolve dependent formulas

If have a spreadsheet using several quite complicated formulas “in a row”, which also depends on each other. Recalculation triggered by changing the content of some (specific) cell results in a #VALUE! error in some cells.

Manually recalculation (using ctrl+shift+f9) fixes this.

As far as I understand, there is no circular dependency, but I can be wrong.

Am I doing something wrong? If yes, is there a way to fix the calculations?
If no, is this a bug?

I stripped-down the spreadsheet to some “minimal” example attached here.
The original spreadsheet does make more sense, of course, but the core is still there:
The idea is to calculate start and end of some work package based on dependencies on other work packages. A work package itself can be structured, in which case the start is the earlist start of all sub packages, whereas the end is the latest end of all sub packages.

  • Data can be entered in the cells with the light blue background: some identifier (name), some dependency, and some duration.
  • Subpackages are denoted by a dot, i.e. test1.a means sub package a of package test1.

The obvious problem seems to be, that the end date located in row G is calculated using end dates of all sub packages (a MAXIFS(G:G) formular). For example in the attached spreadsheet end date of test3.b (cell G18) is calculated using data from cells G3:G5.
Imho there should be no (or at least no unsolvable) circular reference, since the conditions in the used MAXIFS() prevent that the result of G18 is used at all. Nevetheless this seems to be the issue (i.e. causes the #VALUE! error). If I decouple the MAXIFS() ranges, i.e. handle row 3 to 10 by its own as well as row 11 to 20, it works like expected.

How to reproduce the issue in the attached example spreadsheet:

  1. Delete content of cell D8 (marked yellow) with key Delete.
  2. Renter the very same value test1 again.

Environment:

  • Version: 6.1.5.2
  • Build ID: 1:6.1.5-1
  • CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: x11;
  • Locale: de-DE (en_US.utf8); Calc: group threaded

In the original spreadsheet I sometimes need to trigger the recalculation more than once to get every cell calculated as expected. Sometimes LibreCalc even crashes if I trigger recalculation too often. The last seems to be a bug for sure. Nevertheless I want to understand what I am doing before reporting this as a bug.

Is there a canonical way to provide an example spreadsheet?

Yes: using steps from “How to use the Ask site” referred from the site’s main page.

And of course, mentioning version info (LO/OS) is expected :slight_smile: - see “Key detail” section there.

For which for a new user the question needs to be up’ed to be able to attach a file. Done.

@erAck: lately, that’s not needed anymore; you can see in the history that OP has attached the document as soon as I posted the comment.

That link doesn’t download a document for me (despite ending in upfiles/1551546435315945.ods) but just reloads this question page, hence I thought something’s wrong…

@rtAck, thanks. I didn’t noticed that (and was unable to decompile your comment ;). Don’t know what was going wrong. I have just uploaded it again, hope it works now.

File is present now.

Iterations are turned on for the document and there are circular references, as can be easily seen if iterations are turned off then there are Err:522 (circular reference) error results. It is unclear to me what the actual goal of the calculations is and why it involves circular references and iterations. However, iterations with string results are odd as there is no convergence (i.e. delta nearing the result changes), it might work by chance if recalculated in enough circles, hence after an additional Shift+Ctrl+F9. But as I didn’t dive further into the document’s formulas and dependencies I can’t say more about it.

Best you explain what you actually did there and why.

@erAck, thanks a lot, I appreciate your comments. I have updated the question as well as the example. Now it hopefully contains enough information to understand the use case.
Regarding circular references: From my point of view, LibreCalc should be able to solve these. But again, perhaps my understanding is wrong. Furtheremore I am working with dates (hence no strings) afaik. I am only using the null string (="") to denote “no date”.

@erAck, I am now facing the issue that I get Err:523 errors. My guess with reference to provided answer is, that the used formulars still use non-number values (in some cell). Do you know if this could be the case, i.e. if that could also lead to an Err:523?

It seems that I found the cause why the calculations have stopped too early: I used "<>0" in one of the MAXIFS() formulas which obviously was an intermediate value which itself prevents the updated value to be considered in the next iteration. Please let me know if this is likely a bug. In this case I will prepare a bug report.
Nevertheless, this behaviour is out-of-scope of this question.

hello doak, pls. check:

you might be trapped by either:

‘late evaluation of format changes’, cell D8 in your sample contains ‘text’, but is formatted as ‘number’,

(if the format of a cell is changed after input of the value (number, string or formula …) this change - of the format - is intentionally not! evaluated by the program unless the ‘content’ of the cell is changed too. at least it has to be ‘touched’, in plenty cases a ‘non-changing-edit’ is sufficient to trigger recalculation.)

(similar problems might exist in other cells of the sheet affecting your chained calculations)

(annoyingly it’s not visible to the user when and which cells are affected, i doubt plenty users being able to remember in which sequence they keyed and formatted the input of cells)

or:

cells in your document might be ‘excluded from autocalculate’,

(something like this shouldn’t normally happen (sorry for my english - deepl -) but there are way’s - bugs? - to produce it, one source is to edit copies of formulas (groups of ‘shared formulas’ which are created when you place copies of formulas near to the source), another is to change something in ranges shared formulas point to, may bee there are many more ways to produce)

(annoyingly it’s not visible to the user when and which cells are affected)

imho a reliable spreadsheet shouldn’t need ‘hard recalcs’ while autocalculate is on, but that’s another question …

i couldn’t test your sheet with a version which - as i hope - is free from the second possibility, ver. 4.1.6.2 shows the sheet correctly on load, but switches to #NAME! in plenty cells after the first edit, i think there are formulas / functions in your sheet not known to this version …

reg.

b.

I am just evaluating the first idea and it seems to be the issue. I fixed it in the example spreadsheet by just removing all "" fallback values I used to distinguish between no value and zero value. It does not work in the orignal spreadsheet yet, I am on it to transform the logic and see if it works.

ver. 4.1.6.2 shows the sheet correctly on load, but switches to #NAME! in plenty cells after the first edit […]

Perhaps you were caught by a bug in context of named ranges. There are plenty: https://bugs.documentfoundation.org/show_bug.cgi?id=109178

I am still trying to fix my spreadsheet. Nevertheless I voted your answer up because it provided very important input to understand the issue.
The original error is gone, but experience now Err:523 (“The calculation procedure does not converge”) and the fact, that the calculated values are sometimes wrong.

It seems I managed to fix my spreadsheet. I will eventually accept your answer. Do you mind to reformat your answer to be more clear (e.g. structuring with headers, codeblocks for cell names, etc.)? It was okay for me, since I knew the context, but it would be very great for other readers (in the future). I would do it by my own, but I don’t have enough karma (200 is needed for this priviledge).

Please let me know, too, if I shall rephrase/improve my answer as well.

hello @doak,

i’d given the answer as good as i can, it’s intentionally not an analysis of your work and problems, as that looks very complex to me. i just had the idea that the two points mentioned might affect your calculations.

if you have time to report about the results i think you are allowed to answer your own question, feel free to use all or parts of my text, feel free to change as well …

@all - the fact that i described the behaviour doesn’t mean that i like it, in my opinion neither ‘late evaluation of format changes’ nor ‘excluding cells from autocalculation’ are good ideas for a spreadsheet that should help users to get their work done instead of irritating them …

reg.

b.

@newbie-02, my itention is really only about formatting to be more skimming-friendly for new readers which stumble about the very same question because of LibreOffice’s “short-comings” (like you pointed out).

The content of your answer is valid and should really be preserved, even if the “excluded from autocalculate” was not the issue: it might be for others.

I won’t create an extra answer just for the formatting. Imho this is bad practice. Perhaps somebody with enough karma will improve the style.

Nevertheless, thank you very much for your great answer. It really helped me out! See you :wink:

[…] one source is to edit copies of formulas (groups of ‘shared formulas’ which are created when you place copies of formulas near to the source) […]

@newbie-02, btw: I found no reference to “shared formulas” on the web. Can you provide a link or some more detail on this? In other words: how do I detect if I face issues with shared formulas not calculated correctly?
Thanks!

@doak: ‘shared formulas’ are as new to me as to you, look around on this site:
https://bugs.documentfoundation.org/show_bug.cgi?id=123714, and: ‘Those shared formula groups were introduced in some earlier (4.2 IIRC) version, so of course before that these things worked. Yes their dependency handling is broken and was from the beginning it seems.’ mentioned there.

calc "shared formula" - Bing,

afaik there is no indicator in user view / user level showing that this feature is ‘on’ or working for him,

from comments i’d read about and from own experiments:

used likely when you place identical or very similar formulas direct above or below each other,

difficult to handle when something changes in ‘the field around’,

reg.

b.