Forum Discussion
Create column with "Like in SQL"
- 10 years ago
As KGrice said, you can create a new column by using the SEARCH function like below. BTW, the search function is case insensitive.
Column = IF ( SEARCH ( "B*", Table1[column1],, 0 ) = 0, IF ( SEARCH ( "A*", Table1[column1],, 0 ) = 0, "Others", "Apple" ), "Ball" )Best Regards,
Herbert
As KGrice said, you can create a new column by using the SEARCH function like below. BTW, the search function is case insensitive.
Column =
IF (
SEARCH ( "B*", Table1[column1],, 0 ) = 0,
IF ( SEARCH ( "A*", Table1[column1],, 0 ) = 0, "Others", "Apple" ),
"Ball"
)
Best Regards,
Herbert
If the number of characters proceeding your % is variable, this task is actually not so easy (imagine how you would like to deal with "air" and "chair" for example). With fixed number of characters, you could use Text.Start("YourText", NumberOfCharacters) and then perform a lookup to your lookup-table.
But if it's variable, you could use Text.StartsWith to check if the text starts with any given string from your lookup-table. You need to use a function in order to iterate through the lookup-table and return the lookup-value if true.