MM_LOOP function

Creates a loop (multidimensional cells) from one range.

Written By Son Nguyen (Administrator)

Updated at September 13th, 2023

Description

Creates a loop (multidimensional cells) from one range. Basically, it enables Mind to launch different scenarios. 

In Mind, you can navigate through all dimensions index of the cells that use the MM_LOOP function.

Syntax

=MM_LOOP("Name", Range, [Index], [IndexStart], [IndexEnd])
  • "Name"
    String. Name used to refer to the loop.

  • Range
    Case 1: One row or one column used as the dimensions of the loop.
    Case 2: You can also call a single cell whose value is an integer n. In that case, the dimensions of your loop are integers up to n: 1, 2, ..., n.

  • Index (optional)
    Index of the loop dimension displayed on Excel. Default value is set to 1.

  • IndexStart (optional)
    Index of the first element to be looped on. Default value is set to 1. 

  • IndexEnd (optional)
    Index of the last element to be looped on. Default value is set to the size of Range.

Remarks

  • If you wish to refer to one existing loop in the MM_LOOP function, the Name of that loop should be used. In that case, the Range you use in each MM_LOOP function of that specific loop should be of the same length.

  • In Mind, you can navigate through the different dimensions of your loops; at the top of your tables, loop indexes are displayed (if they exist for the tables). You can choose to display labels instead by using the MM_LOOPLABELS function‍.

  • If you want to create a loop which size changes depending on different instances, use MM_LOOPINSTANCE instead. You may need to read more about instances structure beforehand.

Example 1: Basic case

  • Formula 1: =MM_LOOP("Scenario", A3:A4)
    Returns 1 in Excel (Default value of Index is 1). Returns 1 for dimension index 1 and 2 for dimension index 2 in Mind for the loop Scenario.

  • Formula 2: =MM_LOOP("Scenario", B3:B4)
    Returns 5 on Excel (Default value of Index is 1). Returns 5 for dimension index 1 and 10 for dimension index 2 in Mind for the loop Scenario

  • In Mind, the table #Loop will thus show as results the first row of table #Dimensions for dimension index 1 and the the second row of the latter table for dimension index 2. 

Example 2: Two loops

You can add as many loops as you like. In this example, we added another loop Product which has 3 dimensions.

The following table depends on the loops Scenario and Product, in particular, the last cell. Thus, it has exactly 6 dimensions (2 scenarios multiplied by 3 products).

It is possible to access all dimensions by clicking on the button next to the loop names. The first columns show the loop indexes and the last ones the results of the table.

Example 3: Second parameter refers to a single cell

As mentioned in the syntax description of the function, it is possible for Range to refer to a single cell which contains an integer n. In that case, the dimensions of the loop are 1, 2, ...n.

For the above example, the formula =MM_LOOP("Loop",A1) creates a 4-dimensional cell whose values are 1, 2, 3 and 4.