Forum Discussion
Chips2220
3 years agoRegular Visitor
If text contains then multiple
Hi
I'm new to power query. I'm trying to create a custom column which says, 'if text in column A contains the word 'monthly' then divide value in column B by (5 * 4)
How would that look in a custom column.
if Text.Contains([Value.1], "Monthly", Comparer.OrdinalIgnoreCase) then ([Value]/22) else if Text.Contains([Value.1], "Weekly", Comparer.OrdinalIgnoreCase) then ([Value]/5) else if Text.Contains([Value.1], "Fortnightly", Comparer.OrdinalIgnoreCase) then ([Value]/10) else [Value]this worked
2 Replies
- Vijay_A_VermaMost Valuable Professional
Use this
= if Text.Contains([ColumnA],"monthly",Comparer.OrdinalIgnoreCase) then [ColumnB]/(5*4) else [ColumnB]
You may need to check whether else condition is allright or not.
- Chips2220Regular Visitor
if Text.Contains([Value.1], "Monthly", Comparer.OrdinalIgnoreCase) then ([Value]/22) else if Text.Contains([Value.1], "Weekly", Comparer.OrdinalIgnoreCase) then ([Value]/5) else if Text.Contains([Value.1], "Fortnightly", Comparer.OrdinalIgnoreCase) then ([Value]/10) else [Value]this worked