Re[2]:  Recalculate and Recalculate Hard in Calc

Steve Fanning stevemfanning.wh at
Tue Jun 9 07:45:18 UTC 2020


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



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

>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
>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.
>Best regards,
>Mike Kaganski

More information about the LibreOffice mailing list