Date: prev next · Thread: first prev next last
2020 Archives by date, by thread · List index


Mike,

Many thanks for clarifying that. It helps me to understand what is going on.

Regards,

Steve


------ Original Message ------
From: "Mike Kaganski" <mikekaganski@hotmail.com>
To: "Steve Fanning" <stevemfanning.wh@gmail.com>; "libreoffice@lists.freedesktop.org" <libreoffice@lists.freedesktop.org>
Sent: 09/06/2020 07:53:47
Subject: Re:  Recalculate and Recalculate Hard in Calc

Hi,

On 08.06.2020 13:01, Steve Fanning wrote:
 I’m having a problem understanding the Help information for these
 functions (search for “recalculate” in the Help index).

 The Help seems to state that choosing Data > Calculate > Recalculate (or
 its equivalent shortcut F9) “recalculates the currently selected cells
 and formula cells that depend on them”. Whatever I try in Calc, these
 interactions affect lots of cells, not just those currently selected.

 In an empty spreadsheet, try the following:
 (a) Set Data > Calculate > AutoCalculate to off.
 (b) Type =a1+1 into cell a2.
 (c) Type the value 1 into cell a1.
 (d) Type =e5+1 into cell e6.
 (e) Type the value 1 into cell e5.
 (f) Select cells e5 and e6.
 (g) Choose Data > Calculate > Recalculate or press F9.
 When I do this, the value in the unselected cell a2 is updated.

 Is the Help inaccurate or am I muddled?

 And, if my example above is valid, what does Recalculate Hard do that
 Recalculate doesn’t?

FTR: the code for Recalculate (F9) is ScDocShell::DoRecalc; for
Recalculate Hard (Ctrl+Shift+F9) is ScDocShell::DoHardRecalc.

The former first sets current cell "dirty", then calls
ScDocument::CalcFormulaTree (that recalcs *all* *dirty* cells in the
document) and ScDBFunc::UpdateCharts (to make sure the changes get into
charts).

Thus, if the document contains many dirty cells (as working in disabled
AutoCalculate mode), F9 would make sure that currently selected cell is
dirty (to make sure it recalcs), but then will recalc not only it, but
all other dirty cells. But called next time in the same mode, only
current cell plus cells made dirty after last recalc will update (not
all formulas, which might be many thousands).

ScDocShell::DoHardRecalc calls ScDocument::CalcAll (that recalcs *all*
formula cells, not only dirty ones), then ScDocFunc::DetectiveRefresh,
then ScDBFunc::UpdateCharts.

Thus Ctrl+Shift+F9 will take much longer than F9 in documents where most
cells are up-to-date.

HTH.

--
Best regards,
Mike Kaganski


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.