Hello I have several columns with data and I want to add another col which will get a formula like this:
A B C
2 5
3 4
5 5
4 7
C column will get an if else formula for example: If(A&B==4 then C ==Good) else if(A&B==3 then C ==bad) else if(A&B==1 then C ==Good)
How can I write this in a formula ?
This code will do what you described:
New Table( "Untitled", Add Rows( 6 ),
New Column( "A", Numeric, "Continuous", Format( "Best", 12 ),
Set Values( [2, 3, 5, 4, 4, 1] ) ),
New Column( "B", Numeric, "Continuous", Format( "Best", 12 ),
Set Values( [5, 4, 5, 7, 4, 1] ) ),
New Column( "C", Character, "Nominal", Formula(
If( :A == 4 & :B == 4, "Good",
:A == 3 & :B == 3, "Bad",
:A == 1 & :B == 1, "Good"
)
)
)
);
Craig's link is excellent, especially because it discusses what happens with null values.
If Secrets has a good description of how to use the If() function.