MM_COLUMN function

Returns a column range starting from a given cell and ending at the last row of the corresponding table. Used for dynamic tables.

Written By Nikolas Ethoré (Super Administrator)

Updated at August 22nd, 2022

Description

Returns a column range starting from a given cell and ending at the last row of the corresponding table. Used for dynamic tables. In Excel, it returns a column range starting from the specified cell and ending at the first empty cell (excluded).

Syntax

=MM_COLUMN(Cell)
  • Cell
    Starting cell of the column.

Remarks

  • Warning: This formula has a different behavior in Excel and in Mind. See the first example. 

  • This function is useful when you have dynamic tables, i.e. when the size of your table varies, for instance, if you use the input manager, interlinks, or dynamic instances. 

  • See MM_ROW function‍ to return a row range. 

Example 1: Summing the cells of one column

Notice that for "Type B", there is no value on the left column.

In Excel, the formula :=SUM(MM_COLUMN(B3)) returns 41 as MM_COLUMN(B3) stops at the first empty cell starting from the input cell B3. To be more precise, MM_COLUMN(B3) is exactly equal to the reference B3 in Excel. 

In Mind, the spreadsheet is divided by defined tables. The function MM_COLUMN(B3) returns the second column of the table starting from B3. Thus, the entire formula returns the sum of the second column which is 55.

The benefit is that if you add 10 more assumptions, you do not need to change the formula in C3. 

Example 2: Defining dynamic instances

Prerequisite knowledge: read the article Introduction to instances‍ to learn about instances.

The formula :=MM_LOOP("Loop"&MM_INSTINDEX(),MM_COLUMN(A3)) enables to define a loop specific for each instance. In this case, "Loop1" is specific to the first instance, "Loop2" to the second instance, and so on (of course, instances should be added beforehand and assumptions imported for each instance). What is interesting here is that the range of each loop is defined with MM_COLUMN(A3), which means that the loops can be of different lengths. For example, you can have 5 scenarios for the first instance and 3 scenarios for the second instance.