I will assume that although the cell references includes the row number, for migrating to KNIME we are interested only in the column name, and so for the example, we can refer to it simply as columnF, columnM, columnI and columnP. You will need to change this to reference you actual columns.
Since the formula involves concatenation and trimming of the output, the Rule Engine node is unsuitable (since it allows us only to output single literal values or column values. It does not allow any manipulation of the output.
Therefore the main choice of node for replicating this is Column Expression, String Manipulation, Java Snippet and (in KNIME 5.3 onwards) the Expression node.
To achieve the above with String Manipulation, the code would be something like the below - no guarantees, as I have no data to test it with):