Performance of Excel formulas - are they smart enough to skip and remember?

Jaymond Flurrie

Well-known Member
Joined
Sep 22, 2008
Messages
921
Office Version
  1. 365
Platform
  1. Windows
How does the Excel formulas work under the hood? I mean, I can write a long IF-formula, which would logically skip most of the formula, but does Excel solve it all anyway "just in case"?

Also, if I use the same complicated formula multiple times in a formula, does Excel understand that it already calculated the result once and thus dramatically reduce the calculation time or does it just calculate everything anyway?
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Excel does use short-circuit evaluation of IF()s. But ...

...Excel creates a decision tree for calculations—"if Cell A1 changes, then recalculate Cells B2, B5, C3, C6, etc." Nested IF()s can slow down overall Excel performance, as can array formulas, and conditional formatting. I try to minimize IF()s by using Lookup tables, or the Boolean operators AND() and OR(), and using Excel's builtin coercion of TRUE and FALSE to the numbers 1 and 0.

Instead of:
=IF(A1=1, "Low", IF(A1=2, "Middle", IF(A1=3, "High","")))

I will use:
=REPT("Low", A1=1)&REPT("Middle", A1=2)&REPT("High", A1=3)
which does the same thing.

Old article, but still useful: http://blog.excelhero.com/2010/01/21/i_heart_if/

Excel does not cache results for repeated formulas. You're better off performing the calculation once and then referring to the cell that contains the result in subsequent formulas.

For performance optimization, see: https://msdn.microsoft.com/en-us/vb...-tips-for-optimizing-performance-obstructions

To read more than you will ever retain about Excel's calculation performance: http://www.decisionmodels.com/calcsecrets.htm
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,117
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top