MM_ISINSTANCELOADED function

Checks if a chosen current value is in an instance loaded in the current model in Mind.

Written By Nikolas Ethoré (Super Administrator)

Updated at November 24th, 2021

Description

This function checks if a chosen current value is in an instance loaded in the current model in Mind.

Syntax

=MM_ISINSTANCELOADED(Cell, InstanceKey)
  • Cell : Cell containing the value you want to check if it's in an instance loaded in the current model. Cell is not meant to be a range bigger than a cell.

  • InstanceKey: Name of the instance you want to check if the Cell is into.

Remarks

  • The function can return True only if the instance key in parameter is loaded by the model in Mind.

  • You may want to include this function into a condition to access to your cell, in case of partial load.

  • This function is the most relevant in case of partial load. In fact, it checks if the cell you want to access is in an instance loaded or not by your model. You can note that if instance is not loaded by the model (due to partial load), if you want to access to a cell from this instance, the model will return the default value of your cell in Excel. Thus, this function makes sense because you can avoid the model to display this default value and choose instead other values to return.

Example 1 : Basic example

Suppose two workbooks named Treaty and TreatySection, each one duplicated into two instances: Treaty1, Treaty2 for Treaty, TS1 and TS2 for TreatySection.

The following function is written in workbook Treaty:

=MM_ISINSTANCELOADED(A2,"TS1")

The cell A2 is in the workbook Treaty, so this cell is displayed in instances Treaty1 and Treaty2. Indeed, this cell is not in instance TS1 which is a duplication from TreatySection. The function returns then False.

Example 2: Case of a partial load

With same workbooks as before, suppose you have decided to regroup instances as follows:

Suppose you are loading Group 1 in Mind. Group1 is linked to instances TS1, Treaty1 and Treaty2. Thus, instance TS2 is not loaded in the model, that is why if you call a value from a cell in instance TS2, the model will not find it, it will just return the default value of the cell in Excel. To avoid this situation, you can write:

=MM_ISINSTANCELOADED(A5,"TS2")

This function written in the workbook TreatySection returns here False because TS2 is not loaded in the model. You can also condition this formula to avoid the display of a default value when calling this cell:

=IF(MM_ISINSTANCELOADED(A5,"TS2"),MM_INSTANCE(A5,"TS2"),0)

This formula can access to the value of the cell A5 from the instance TS2 only if TS2 is loaded and the value in A5 in TS2. In the case of the load of Group 1 in the model, the formula returns 0. Thus, your model returns 0 instead of a default value in Mind.