# tip Create a Signal which Is Max or Min of Multiple Signals

## Recommended Posts

• Seeq Team

There are various methods to do this. The easiest method is by using the max() or min() functions in the Formula Tool, which are available beginning in Seeq release R21.0.40.05. Here is an example for creating a new signal which is the maximum of 4 other signals:

`\$a.max(\$b).max(\$c).max(\$d)`

You can also see additional information in this related forum post.

Content Verified DEC2023

Edited by Chris Harp
Content Verified DEC2023
##### Share on other sites

• Seeq Team

One limitation to the method mentioned above is if one of the signals doesn't have any values, then no answer is returned. If you still want the value even if one signal is missing than you can try the alternative formula described below. This method works for versions prior to R21.0.40.05.

Here is the formula for 2 signals as shown above:

`\$signal1.zipWith(\$signal2, (\$s1, \$s2) -> max(\$s1.getValue(), \$s2.getValue()))`

If you have more than 2 signals, then add additional zipWith() statements:

```\$signal1.zipWith(\$signal2, (\$s1, \$s2) -> max(\$s1.getValue(), \$s2.getValue()))
.zipWith(\$signal3, (\$s1, \$s3) -> max(\$s1.getValue(), \$s3.getValue()))
.zipWith(\$signal4, (\$s1, \$s4) -> max(\$s1.getValue(), \$s4.getValue()))```

Edited by Krista Novstrup
• 1
##### Share on other sites

• 2 years later...

When I try this syntax I get an error in the formula.  I am at version R50.4.4

Formula

` `
`max(\$p53h2,\$p53h3,\$p53h4)`
⬆ No variant of function 'max' consumes the parameters (Signal, Signal, Signal) at 'max'
##### Share on other sites

• Seeq Team

Hi Brian,

In more recent versions of Seeq, the max function used in that way (that specific syntax or form) only works with scalars.

That is the form needed with signals.

Hope this helps!

John

• 2
##### Share on other sites

Writing it like the following is only supported for scalars:
max(\$a,\$b,\$c,\$d)

If you want to use signals you will need to write it this.
\$signalA.max(\$signalB).max(\$signalC)....

##### Share on other sites

This worked.   thank you