MM_SUMIF function

Returns the sum of values of all dimensions or specified dimensions of a range that meet a chosen criterion.

Written By Nikolas Ethoré (Super Administrator)

Updated at November 29th, 2021

Description

The equivalent of SUMIF Excel function. Returns the sum of values of all dimensions or specified dimensions of a range that meet a chosen criterion.

Syntax

=MM_SUMIF(Value, Condition, [Sum_value], ["Name", Index], ["Name2", Index2], ...)
  • Value
    Cells to sum if they meet the given criterion. If the Sum_value parameter is input, only the position of the cells and the index of the dimensions of Value are used; the corresponding values of Sum_value are added. 

  • Condition
    The criterion used to select which values to sum. Can be string, number or cell reference. Criterion that includes logical symbols (=, >, <) must be written as a string. Ex: ">0".
    Warning: If your version of Excel does not use English notation, be sure to use a decimal point for string criteria. For instance, write ">12.5" instead of ">12,5" as the cultural translation is not automatic for strings. 

  • Sum_value (optional)
    The actual range to sum. If this parameter is not specified, Value is used by default. 

  • "Name", Index (optional)
    String, Integer.
    Name of a loop and index of that same loop you want to access to sum values. If you do not specify any index for a loop, Mind takes all indexes for that loop.
    For stochastic dimension: if you want to sum the results of one specific simulation, you can specify "SIM" as Name and the desired simulation index under Index.

 Warning: The parameter LoopName is case sensitive.

  • "Name2", Index2, "Name3", Index3, ...etc. (optional)
    String, Integer.
    Names and indexes of other loops. 

Remarks

  • There is no point in using MM_SUMIF, if Value (or Sum_value) has no multiple dimensions; the function automatically returns Value without applying the criterion. In that case, you must use SUMIF Excel function.

  • You cannot specify the same loop with different dimensions. If you want to sum two different dimensions of the same loop, one possibility is to use twice the MM_RESULT function for each dimension and a SUMIF Excel function. 

  • Remember to input Sum_value if you input Name, Index, Name2, Index 2, ..., even if Sum_value is equal to Value as Mind does not accept empty parameters.

  • For MM_SUMIF to work correctly, Value and Sum_value must have the same length and the same dimensions. If you use a range and not a single cell in your parameters, the cells of your range also need to have the same dimensions.

  • If no dimension of the cells of Value meet the criterion Condition, the function returns the value: 0.

  • See MM_SUMIFS function‍ to add a set of criteria.

  • See MM_RESULT function‍ to sum dimensions (from loops and simulations) without criteria.
    See MM_SUM function‍ to sum the results of stochastic simulations.

Example 1: No loop and simulations

Formula1: =MM_SUMIF(A2,">0.5"). Given the number of simulations in Mind, the formula returns the sum of the n simulations whose result is greater than 0.5. If n=3 and the results in A2 are 0.4, 0.56, 0.89, then A3 returns 1.45.

Example 2: Two loops, no specified dimension

In this example, cell A7 depends on Loop1 and Loop2; it has 4 dimensions.
The formula :=MM_SUMIF(A7,">40") returns 95, it is the sum of cell A7 for the dimensions whose result is greater than 40. Indeed, the four values of A7 are 37, 38, 47, and 48 and the sum of 47 and 48 is 95.

Example 3: Two loops, specified dimension

This example is similar to the one above but we choose to specify the index of the first loop. We set it to 1. Note that, in this case, the third parameter must be input.
The formula:=MM_SUMIF(A7,">40", A7,"Loop1",1) returns 0, it is the sum of cell A7 for the dimensions whose result is greater than 40 taking into account only the first dimension of Loop1. The values of A7, with a dimension of Loop1 equal to 1, are 37 and 38.

Example 4: Loops and simulations

You can mix the first and second examples to sum cells with loop dimensions and stochastic dimensions.

Example 5: Error example, ranges with different dimension sizes

Formula: =MM_SUMIF(A7,">40",A3)
Cell A7 and A3 do not have the same dimension sizes. Indeed, A7 has two loops and E3 is a one-dimensional cell. In that case, the formula does not make sense and Mind returns 0.

It is possible to force a value for cell A3 for dimensions of Loop1 and Loop2 so that the formula is calculated properly. See formula 4 in the MM_RESULT function‍ article.