Forum Discussion

park's avatar
park
Frequent Visitor
3 years ago
Solved

Create custom column based on two other columns

Hello.

 

I would like to add to a formula to a custom column I have written for changing row values based on another column, but I only want to base it off one value.

 

Consider that I have two columns. Company and Type

CompanyTypeNew Column
PublixNFCH
WalmartERCH
PublixDFCH

I currently have this code = if Text.Contains([Company], "Publix", Comparer.OrdinalIgnoreCase) or Text.Contains([Company], "Walmart", Comparer.OrdinalIgnoreCase) then "CH" else [Type]

 

This would change all the Type to CH in a new column based on that company name. 

 

However, for this example. I would like for only the ones that read NF to switch to CH. I want to keep the ones that say ER the same. Besides ER, I also have 2 other values of Type, take example DF FF, I want these to say the same as well. 

 

So basically, I want my formula to do the same thing it is already doing, except ONLY apply to changing the type of NF in a new column to read CH.

 

It would look like:

CompanyTypeNEW Column
PublixNFCH
WalmartERER
PublixDFDF

 

Thank you.