# How do we solve it..? Math, Rule Engine, Column Expression

Hi All,
in knime how would we pick particular cell to add & subtract to get the result values
Please find the above excel formula.

Hi @sundipsandy , you can use the Lag Column node to get values from other rows relative to the current row for any column. You can then use Math Formula node to do your math operation with the values.

The most recent Column Expressions now has the feature to use the values from another row (check the Multi-row access in the Advanced Tab). This can be done via the function column(column, offset). You can do your Math operations directly in the Column Expressions once you get the values of the desired rows/cells

2 Likes

We canâ€™t just answer a question like this. KNIME workflows create a repeatable process that is designed to withstand future use. Your question (how do we add this row + that row + that rowâ€¦) is a â€śone offâ€ť manual excel calculation with no context. You need to change the way you approach problems in KNIME so that you define what your final end goal is in the abstract (not just try to recreate each manual step that was done in Excel). Then begin to think about how you might build a repeatable and dependable structure to get there using more global tools.

For instance: Lets say you trying to get a grand total of subtotal linesâ€¦

How do we target those rows? Do the account names all include â€śsubtotalâ€ť, do the subtotal names all start with a tab or space character, do the account numbers follow some definite structure, is there always a proceeding or following blank row, is the data structure going to be stable going forward, etc.

What is the end goal of the calculation? Your example could be achieved with a simple groupby sum once you have isolated your target rows, if that was indeed your end goal and not just a step in the process.

Your posts follow a pattern of asking â€śhow do I do this single Excel stepâ€ť without giving context. I would start with looking at some KNIME tutorials on youtube to get your feet under you as to how you might think about things differently in KNIME.

4 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.