BookmarkSubscribe
Choose Language Hide Translation Bar

How to create a formula column to find the maximum of several columns

I have several columns of numeric data (see example below) and I would like to create a formula column to find the maximum value for each row across the columns.  Any help would be appreciated.  Thank you!

Value 1      Value 2      Value 3      Max Value (I would put the formula in this column)

1                    9               6                    9

2                    1               5                    5

3                    7               4                    7

4                    2               6                    6

1 ACCEPTED SOLUTION

Accepted Solutions  pmroz
Super User

Re: How to create a formula column to find the maximum of several columns

The Maximum() function will do this for you.

Maximum(:Value 1, :Value 2, :Value 3)
4 REPLIES 4  pmroz
Super User

Re: How to create a formula column to find the maximum of several columns

The Maximum() function will do this for you.

Maximum(:Value 1, :Value 2, :Value 3)

Re: How to create a formula column to find the maximum of several columns

Thanks ! I knew it had to be something simple.

Re: How to create a formula column to find the maximum of several columns

If you have many rows which you want to search, is there a function to select a range of rows as opposed to typing in every row into the function?

Re: How to create a formula column to find the maximum of several columns

The question asked by @adampaulsmith and answered by @pmroz uses the Maximum() function in a formula define for the resulting column.  The formula will automatically loop across each row and apply the formula.  Thus, no row reference has to be made.

However, if you are using this in open JSL, you can add a subscript to the column references to indicate which row you process.

For( theRow = 1, theRow <= 10, theRow++,
:MaxValue[theRow] = Maximum( :Value 1[theRow], :Value 2[theRow], :Value 2[theRow] );
);

See documentation on JSL in the Scripting Guide

Help==>Books==>Scripting Guide

Jim