How to sum 2 colums in Knime

Hello everybody

I'm new to Knime and would like to sum 2 colums with numeric values(for many of you this is easy task) and output the results into 3rd empty column. Is there a procedure in KNIME like in Excel (with functions) or should I use nodes like Java Snipet or Math Formula. I've tried to manage this operation by Java Snipet and Math Formula( i've read the whole forum about similar question) but I think without success. I'm not just yet familiar with all options and power KNIME can provide.

Sorry if this is a repeated question, but I'm breaking my head over this, so any help would be very appreciated.


that's quite easy with he groupBy node.

You just add the column you want to calculate the sum for in the selection window at the bottom of the dialog and choose sum.


JohnK - When you say you had no success what exactly do you mean. Were there any error messages in the console that would tip you off to the problem?

If you have Java on your machine I'd suggest the Java Snippet node. Just make sure your syntax is correct. just insert into the method body:

return $Col1$+$Col2$;

Of course, replace Col1 and Col2 with your column names. This should do the trick. just make sure your syntax includes 'return' at the beginning and the semi-colon ';' at the end. You can then assign the result to a new column or replace the value of an existing column.

I'll try it,

Thank you yes

a okay got you wrong you want to sum 2 columns =D

jontimko- I'll try to enter syntax return $Col1$+$Col2$; in Snipet node as you suggested. Thank you for your help.

The easiest way is to use the Math Formula node - you can use either of the following expressions:

$column1$ + $column2$



and configure it to Append column (column1 and column2 are the two columns you want to sum).  You don't need any '=' at the beginning of the expression


Is it true that Math Formula node can process only one column at time? So if I have to modify/calculate N columns I must use N Math Formula nodes? Thanks!

Unfortunately it is true, you need to do it N types.


I have also requested such a feature, see this post;


There is a solution using Loops, but I would much prefer a node which lets you select multiple columns.


KNIME team, please implement this!!