Re:  Recalculate and Recalculate Hard in Calc

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

 



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

Attachment: pEpkey.asc
Description: application/pgp-keys

_______________________________________________
LibreOffice mailing list
LibreOffice@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/libreoffice

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux