# new to knime - need help with math formula node

**URL:** <https://forum.knime.com/t/new-to-knime-need-help-with-math-formula-node/73592>\
**Category:** KNIME Analytics Platform\
**Created:** [October 17, 2023, 9:30am UTC](https://forum.knime.com/t/new-to-knime-need-help-with-math-formula-node/73592 "2023-10-17T09:30:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rosyanna\_098](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/r/74df32/32.png) [@rosyanna\_098](https://forum.knime.com/u/rosyanna_098)\
**Post date:** [October 17, 2023, 9:30am UTC](https://forum.knime.com/t/new-to-knime-need-help-with-math-formula-node/73592/1 "2023-10-17T09:30:29Z")

</div>

Hello - I have have created a new calculated column from some data and some of the results are over 100. I need to cap these values at 100. Can anyone please suggest how to do this in the math formula node? I can’t seem to get anything to work.  
I got it working in the Rule Engine with $column$ \> 100 =\> 100 - but this doesn’t work in the math node

---

<div class="post-metadata">

**Author:** ![ipazin](https://forum-cdn.knime.com/user_avatar/forum.knime.com/ipazin/32/806_2.png) [@ipazin](https://forum.knime.com/u/ipazin)\
**Post date:** [October 17, 2023, 9:54am UTC](https://forum.knime.com/t/new-to-knime-need-help-with-math-formula-node/73592/2 "2023-10-17T09:54:02Z")

</div>

Hello @rosyanna_098,

and welcome to KNIME Community!

You can use _min\_in\_args()_ function from Math Formula node as following:  
`min_in_args(yourCalculation, 100)`

Result will be either value from your calculation either 100. Whatever is less.

Br,  
Ivan

---

<div class="post-metadata">

**Author:** ![rosyanna\_098](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/r/74df32/32.png) [@rosyanna\_098](https://forum.knime.com/u/rosyanna_098)\
**Post date:** [October 17, 2023, 9:56am UTC](https://forum.knime.com/t/new-to-knime-need-help-with-math-formula-node/73592/3 "2023-10-17T09:56:29Z")

</div>

I @ipazin thank you! That worked a treat.

---

<div class="post-metadata">

**Author:** ![ipazin](https://forum-cdn.knime.com/user_avatar/forum.knime.com/ipazin/32/806_2.png) [@ipazin](https://forum.knime.com/u/ipazin)\
**Post date:** [October 17, 2023, 9:59am UTC](https://forum.knime.com/t/new-to-knime-need-help-with-math-formula-node/73592/4 "2023-10-17T09:59:39Z")

</div>

Glad to hear that!  
Ivan

---

<div class="post-metadata">

**Author:** ![takbb](https://forum-cdn.knime.com/user_avatar/forum.knime.com/takbb/32/57077_2.png) [@takbb](https://forum.knime.com/u/takbb)\
**Post date:** [October 17, 2023, 11:12am UTC](https://forum.knime.com/t/new-to-knime-need-help-with-math-formula-node/73592/5 "2023-10-17T11:12:04Z")

</div>

Hi @rosyanna_098 , the Math Formula node also has an `if(condition, result-if-true, result-if-false)` function similar to Excel’s if() statement,

e.g.

```auto
if($column1$ > 100, 100, $column1$)

```

which is the direct equivalent of Rule Engine’s

```auto
$column1$ > 100 => 100
TRUE => $column1$

```

Conditions can be nested, for example:

```auto
if($column1$ > 100,
   100,
   if($column1$ < 0, 
        0, 
        $column1$)
  )

```

which would result in anything greater than 100 being 100, and less than zero becoming zero, and is the equivalent of:

```auto
$column1$ > 100 => 100
$column1$ < 0 => 0
TRUE => $column1$

```

---

<div class="post-metadata">

**Author:** ![rosyanna\_098](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/r/74df32/32.png) [@rosyanna\_098](https://forum.knime.com/u/rosyanna_098)\
**Post date:** [October 18, 2023, 3:08am UTC](https://forum.knime.com/t/new-to-knime-need-help-with-math-formula-node/73592/6 "2023-10-18T03:08:42Z")

</div>

Thank you @takbb much appreciated! Good to see the variations in how I can do this.

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [October 25, 2023, 3:08am UTC](https://forum.knime.com/t/new-to-knime-need-help-with-math-formula-node/73592/7 "2023-10-25T03:08:59Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
