Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Choose Language Hide Translation Bar
Highlighted
Nithian
Level I

Spell out Column Name which has the min and max number in the same Row

Hi,

Pls help me on generating a new column formula for calling out the Column Names which has the min and max number in the same row.

From this

Before.PNG

to this

after.PNG

 

 

5 REPLIES 5
Highlighted
ms
Super User ms
Super User

Re: Spell out Column Name which has the min and max number in the same Row

This column formula should work quite generally. It's independent of column names. However, it assumes the data columns are in a sequence and the column number of the start and end columns must be set (as local variables).

 

Get name of column with max value:

Local( {start = 2, end = 7, L = Current Data Table()[Row(), start :: end]},
	Column( Loc Max( L ) + start - 1 ) << get name
);

And for min:

Local( {start = 2, end = 7, L = Current Data Table()[Row(), start :: end]},
	Column( Loc Min( L ) + start - 1 ) << get name
);

 

Highlighted
Nithian
Level I

Re: Spell out Column Name which has the min and max number in the same Row

Hi Ms Super User -

I tried it but not working. I found it in Excel formula, but not sure how to convert it to Jmp. As per in this screenshot

 

=INDEX($B$1:$F$1,0,MATCH(MAX($B2:$F2),$B2:$F2,0))

 

Max.PNG

Highlighted
ms
Super User ms
Super User

Re: Spell out Column Name which has the min and max number in the same Row

What version of JMP do you use? The formula I posted utilize data table matrix notation, a feature I think came with JMP 13.

 

 

Highlighted
Nithian
Level I

Re: Spell out Column Name which has the min and max number in the same Row

Hi MS SUPER USER,

I figure it out to get it work. Thanks. Jmp14.

It looks like we can only make it work when it's treated as local columns. Is there a way to name them by the original column name, instead of column numbering? The reason I am asking, if someone added/appended some columns in the data table, the column numbering may not work properly.

Highlighted
tarkan_bih
Level III

Re: Spell out Column Name which has the min and max number in the same Row

How would you do this if the data columns sequence are not in order? Is there a way to do this by giving column names of interest and then generating a column that shows the max/min column name?