Module 6 - Volatility Lab TOPICS COVERED: 1) EHA Volatility Lab (0:07) 2) Review Formulas for Volatility (2:15) 3) CalculationCount UDF (9:15) 4) Other Routines (10:46) 5) Avoid Volatile Formulas! (12:02) EHA Volatility Lab (0:07) Overuse of the volatile formulas and functions can destroy the responsiveness of Excel models. This Module 6 - Volatility Lab - 1
cannot be emphasized enough. The EHA Volatility Lab was built to test and help you understand the volatility of functions you may use when developing Excel models. EHA Volatility Lab (continued) The Volatility Lab is setup as follows: Groups: It is preloaded with 35 scenarios grouped as Volatile, Non-Volatile, and Quasi-Volatile. Column Layout: Column A shows a description of the formula being tested. Column B shows the formula in action. Column C shows the result of the CalculationCount UDF that tests for volatility. If the formula is volatile, this column will increment. Command Buttons: Module 6 - Volatility Lab - 2
F9 button: Functions exactly as the F9 button on the keyboard... it forces Excel to calculate. Full Calc button: Forces a full-recalculation which forces even non-volatile and quasi-volatile functions to calculate. Reset button: Resets all the formula calculation counters back to 1. Module 6 - Volatility Lab - 3
Review Formulas for Volatility (2:15) Very few functions in Excel are volatile... but unfortunately, some of the most useful ones are... Module 6 - Volatility Lab - 4
Now() and Today() ought to be Strange Quirks: (1) The SUMIF and AVERAGEIF functions are usually volatile, but it is not not volatile in the case where the last input is a range of equal size to the first input. (2) The IF function and the CHOOSE function are sometimes called "short-circuit" functions because only one branch is evaluated depending on the input. (a) If a volatile function is placed into the branch that is not evaluated, it is evaluated regardless. So this example shows an otherwise non-volatile function is made volatile. (b) If a reference to a volatile function is made in the non-evaluated branch of an IF statment, then the function is non-volatile. After several updates to formulas and clicking the command buttons to force calculations, you can see above how the worksheet functions in demonstrating formula volatility. Module 6 - Volatility Lab - 5
CalculationCount UDF (9:15) (1) An array called lngcounts (100 x 100) is shared using Public This array allows for the use of the UDF CalculationCount to be used anywhere within its 100 x 100 boundaries. The UDF is passed a one-cell range that has a formula to be tested for volatility. (2) Application.Caller is used to determine the row and column that originated the call. (3) Then we increment the row,column position in the lngcounts array. Remember that lngcounts is a shared variable, so it retains its values from call to call. (4) Set a dummy variable to r. Since this is a function, we must use the range that was passed into the function in some way, or it will not work. So by setting a dummy variable equal to r, r is used, even though we are not doing anything with that Range parameter. Module 6 - Volatility Lab - 6
Other Routines (10:46) VBA routines for the command buttons in the worksheet. Avoid Volatile Formulas! (12:02) A significant number of things that cause volatile formulas to recalculate: Module 6 - Volatility Lab - 7
1) Clicking or double-clicking on row or column dividers. 2) Inserting or deleting rows or columns. 3) Adding or deleting worksheets. 4) Changing the name of a worksheet 5) Adding, deleting, or editing a named formula. 6) Using the Undo or Redo commands. 7) Changing any value on the worksheet. Strive to avoid volatile formulas as much as possible! Module 6 - Volatility Lab - 8