Need Help with a Monarch Formula

Al_22614
Al_22614 Altair Community Member
edited February 2021 in Community Q&A

I am looking for a simple Monarch formula which returns the number of values within a set of values that is greater or less that a given values. 

For example a formula which counts how many values in the set of numbers, as below, which are GT or EQ 1.5

(1.0, 1.5, 1.9, 1.4, 0.8)

Answer = 2

Note:  The values will be numeric data fields

 

Tagged:

Best Answer

  • CPorthouse
    CPorthouse
    Altair Employee
    edited February 2021 Answer ✓

    One solution would be to use multiple if statements:

    if(col1>=1.5,1,0)+
    if(col2>=1.5,1,0)+
    if(col3>=1.5,1,0)

    If the value is GTE 1.5 then return "1" else "0" and then add those values together.

Answers

  • CPorthouse
    CPorthouse
    Altair Employee
    edited February 2021

    In the example you provided above, would those values be:

    • on the same row but in separate columns
    • on the same row and in the same column
    • single row each and one value in one column?
  • Al_22614
    Al_22614 Altair Community Member
    edited February 2021

    Thanks for your reply...

    The values will be 

    • on the same row but in separate columns

    Thanks

  • CPorthouse
    CPorthouse
    Altair Employee
    edited February 2021 Answer ✓

    One solution would be to use multiple if statements:

    if(col1>=1.5,1,0)+
    if(col2>=1.5,1,0)+
    if(col3>=1.5,1,0)

    If the value is GTE 1.5 then return "1" else "0" and then add those values together.

  • Al_22614
    Al_22614 Altair Community Member
    edited February 2021

    Yes... I was trying to get around the "If" statements.  OK... I need a quick fix, so I will try this approach.

    Thanks

  • Al_22614
    Al_22614 Altair Community Member
    edited February 2021

    Thanks Chris... This worked well for my requirement.  My final formula is:

    If([02-Monday1Z]>1.50 .And. [02-Monday1Z]<=1.75,1,0)+

    If([03-Tuesday1Z]>1.50 .And. [03-Tuesday1Z]<=1.75,1,0)+

    If([04-WednesdayZ]>1.50 .And. [04-WednesdayZ]<=1.75,1,0)+

    If([05-Thursday1Z]>1.50 .And. [05-Thursday1Z]<=1.75,1,0)+

    If([06-Friday1Z]>1.50 .And. [06-Friday1Z]<=1.75,1,0)