Using the Function Swap Utility

Simulation Master Tutorials > Using the Function Swap Utility

The function swap utility allows for importing and exporting of Simulation Master functions.  There are two purposes for function swap:

  1. To replace cells containing Simulation Master functions with their current values or a user-specified value so the workbook can be shared with someone who doesn't have Simulation Master installed.
  2. To create a backup copy of Simulation Master function formulas in a new worksheet.

Function swap works by scanning all worksheets in the current workbook and looking for cell formulas that begin with Simulation Master functions.  If a Simulation Master function is not at the beginning of a formula, it will not be exported/imported.  For example, the following formula will not be caught by function swap.

=C27*RVNORMAL(10,2)

During a simulation, this cell would also not be recorded on the simulation data sheet.  A good practice is to do one of two things:

  1. Enclose the formula inside the RVUSERDIST( ) or HIDERV( ) functions.  The example above would then be: =RVUSERDIST(C27*RVNORMAL(10,2))
  2. Move any Simulation Master functions to a new cell that only contains the function.  If we moved the RVNORMAL(10,2) function to cell D27, the formula for the example above would then be: =C27*D27.

A worksheet containing Simulation Master functions is shown below.  The cells that are shaded green contain the functions.  To use function swap, click the Function Swap button on the ribbon.

The Function Swap form will appear.

Exporting Simulation Master Functions

To export all Simulation Master functions in the workbook, click the export functions selector button.

There are three options for how the cells containing each function will be populated after exporting.

Do not replace function cells

This is used when exporting functions for back-up purposes.  The cells will still have Simulation Master functions as their formulas when exporting is finished.  In other words, the cells will not be changed.

Replace functions with their current values

When this option is selected, the formulas in cells containing a function will be deleted and the cells will be replaced with the current numerical value shown in the cell.

Replace function cells with value below

When this option is selected, the formulas in cells containing a function will be deleted and the cells will be replaced with the contents of the box below this option.  If the box is left blank, all cells containing a function will be blank after exporting.

 

For our example, we will replace the functions with their current values.  The Function Swap form will look like this:

Click OK to perform the export.

The Simulation Master functions and their cell addresses will be stored in a new worksheet as shown below.  Note that each function in column B is disabled by placing an apostrophe in front of the formula.  This will not affect users without Simulation Master installed.

The model sheet cells that contained Simulation Master functions now contain the values that were present when export occurred.

Importing Simulation Master Functions

Open the Function Swap form by clicking the Function Swap button on the ribbon.  Simulation Master functions can be imported back into their original cell addresses by clicking the import functions selector button.  Select the appropriate stored variables sheet in the drop-down box.  The form should look like this:

Click OK to perform the import.

 

The model sheet will now have the Simulation Master functions restored.  The stored variables sheet will not be deleted and can be used to import variables again.