column multiplication based on the string in the first column

Hello everyone,

I have a problem with the following task.

The first row in my table contains a key code that is composed of letters and numbers. Then the rest of the table contains columns with numbers.
I would like to do the following operation:

If the key code in the first column contains 57D then multiply A with E column. If the key code in the first column contains 62E then multiply B with C column and finally if the first column contains 97F then multiply D with F column and put the results in the column “outcome”.

The key code is a unique generated string and it has either 57D or 62E or 97F.

Down there is an example of what I would like to achieve.

I will be grateful for any suggestions

key_code A B C D E F outcome
6197FA 5 6 1 4 1 6 24
2562E 9 5 5 9 4 4 25
98562E 8 8 69 3 0 7 552
6997FD 3 3 3 7 9 4 28
6157DA 1 4 7 5 1 9 1
A62E5843 0 9 8 8 7 9 72
5397FG 8 7 2 2 6 6 12
AC97FF 7 2 5 2 8 3 6
strong text

Hello @Amanda252,

for a one node solution you can use Column Expressions node. It features if() function which you can combine with contains() function to check which key code is generated and based on that calculate your outcome column. If you are not familiar with above mentioned node check this workflow example:

Br,
Ivan

2 Likes

Thank you very much for your suggestion - it does exactly what I asked for however, I am just wondering how can I create one “common” column for the outcomes. Because right now I have 3 expressions with three different created columns in the table.

Hi @Amanda252 , using @ipazin 's suggestion, you shall get a result like this:

As you can see, the final column is similar to the outcome column.

Here’s the configuration:

4 Likes

@badger101 @ipazin

Thank you for your help. It works perfectly :slight_smile:

3 Likes

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