Extracting column name based on max and min value

Hi Knime community

I am wondering to know if i can extract the name of column based on max or min function in additional column. The results am looking for are shown in the sample table.

Value 1 Value 2 Value 3 Value 4 Value 5 Result - Max Result - Min
Row 1 26 27 16 37 30 Value 4 Value 3
Row 2 26 32 39 34 7 Value 3 Value 5
Row 3 19 19 23 15 36 Value 5 Value 4
Row 4 15 5 24 17 9 Value 3 Value 2

will appreciate your help and support in this regard.

@Mobihashim01 ,

Could you please provide input and output sample data ?

Hello @Mobihashim01
You may find vey useful the following node:


1 Like

thanks for the reply. I have provided the table in my message highlighting what data i have and what i am looking for. I will explain here:

I have table with 5 rows and each row has 5 values in 5 different columns. Based on max and min function, i want to know which column has the max value. e.g.


In the sixth column i want Col4 and in 7th column i want Col3 coz Col4 and Col3 carries maximum and minimum value respectively.

Hope this clarifies

1 Like

thanks. this is useful but not serving my purpose.

1 Like

I think this can be done using the Column Expressions and Unpivot nodes. I will try to throw together a workflow when I have an opening in my day.

here’s my approach. apologize if it doesn’t meet your expectations.
KNIME_min-max_MM.knwf (159.0 KB)


KNIME_Max_ColumnName.knwf (63.2 KB)

Nice @marzukim. Here is the non looping approach that I was thinking of earlier.


@marzukim thank you very much. i will try this workflow.

@iCFO i am unable to open the file you sent. i have imported it in knime but it does not allow me to see the workflow. I am very sorry for such a basic question. Please find below the screen shot. Double click on the file or drag and drop does not work.



@iCFO i tried using yours but unable to do so. Apologies for my very little knowledge. I could not find the metanode in the library, the one you are showing after “loop start” node. Secondly don’t know what to configure the “Row ID” node. Will be grateful of your further help if possible

@marzukim the above message is for you. mistakenly tagged it to iCFO. Sorry about that.

sorry experts and my sincere apologies for my ignorance. As i have stated previously that i am quite new and learning knime while using it for my work. This is proving to be extremely hard but i am not giving it up and neither i have any plans to give up. I am forcing myself not to use excel and Access where i am reasonably comfortable. Hence this is unlearning and new learning at the same time. Hope this helps to understand my situation.

Now getting back to the question. I have managed to download and import both of the flows. First i am using the once posted by @iCFO. quite impressive work. thank you very much.

I am stuck in your metanode where Column 1 & Columns 2 are used. Could you please help further what these columns are for so that i could replace those with my relevant columns names?

thanking you in advance once again.

kind regards

Hello @Mobihashim01 ,

I have completed the following workflow for your reference. Please find the attached image of the workflow and the workflow file.

Extracting column name based on max.knwf (48.3 KB)


1 Like

Hey @Mobihashim01,

I think you may be mixing up which workflow was from which user, so I am attaching a version of mine that includes my user name at the end of the file name. Mine was the one that didn’t utilize loops in the construction for better efficiency (and didn’t have a Metanode / Column 1 or Column 2 names). My version should dynamically adapt to different column names if you filter out the columns that are not being compared, so you shouldn’t need to do anything else to adjust for your table structure.

KNIME_Max_ColumnName-iCFO.knwf (72.3 KB)

Edit: I also added the Minimum calc as well (and re-uploaded) in case you needed that.

1 Like

in my workflow, those metanodes are are just groups of nodes that you can expand for a more detailed view.
the rowID node can be useful for replacing the ‘RowID’ of the input data with values from another column, it converts those values to strings.

however, for better performance, i recommend using a non-looping approach based on the @iCFO method. in knime, a non-looping approaches generally perform better than looping approaches.


thank you both @iCFO and @marzukim. I agree that the solution proposed by @marzukim is far easier for me to use.

@marzukim This is working fine. thank you so much. THis solution is working until the node "Columns Rename Regex but at the second last column Agender, it gives the error message:

Another observation is my RowIDs as not matching as shown below:

Will be grateful of your further help in this regards.


1 Like

Hey @Mobihashim01,

It is hard to tell what is happening based on the screenshot image… I adjusted my workflow to use a Join approach based on a Counter Generation node instead of Row IDs. I also included a Table Difference Finder node on the side so that you see that all of your input rows remain in the output. (A blank output means no differences) Hopefully this works for you.

KNIME_Max_ColumnName-iCFO.knwf (124.4 KB)

In general when looking for help on the forum, I recommend putting some non-confidential data into your table structure that shows the issues, then Exporting KNIME Workflow, then uploading it to the forum. That allows us to see the workflow issues ourselves and provide better solutions.

thank you so much once again.

I have figured out the problem with my ROW IDs i was using Concatenate original row keys checkbox which is default settings. Changing it to “Assign new row keys sequentially” seems to solve my problem and yes i started using Joiner instead of column appender. But all in all a great learning session from the experts like you.


1 Like