How to calculate in data table with if

Options

Hello Community,
I try to calculate in my data table to calculate with If.
In a defined column there should insert the result, so the value for the calculation is different there for I need If.
I hope you can help me!
I try to write it down:
Columns[5]= If (Columns[1]=TEXT1)
Columns[2]5
Else if (Columns[1]=TEXT2)
Columns[2]
6

I want to realize it with the Action Apply Formula to Columns.

Best Answer

  • Nick_130752
    Nick_130752 Posts: 11
    Answer ✓
    Options

    Hello,
    Based on what you wrote out, I think the formula you're looking for is something like this:

    if (columns[1] === 'TEXT1') {
      columns[5] = columns[2] + '5'
    } else if (columns[1] === 'TEXT2') {
      columns[5] = columns[2] + '6'
    }
    

    Hopefully this helps!