Forum Discussion
Need help in doing keyword Search
- Anonymous1 year ago
Hi Anonymous
You can add a custom column in table and input the following code.
=List.Accumulate(List.Numbers(0,Table.RowCount(KeywordSearchB),1),"No",(state,current)=>if Text.Contains(Text.Lower([Product Title]),KeywordSearchB[KeywordSearch]{current}) then "Yes" else state)For the keywordsearcha table, just replace the
it can work.
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous Hi! Instead of checking each keyword individually, use the List.Contains function to check if any of the keywords are present in your records. This method is typically more efficient. Here a M code example:
let
// Sample Data
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Keywords = {"Apple", "Pear"},
// Add a column to check if any keyword is present in the Record
AddedCustom = Table.AddColumn(Source, "Contains Keyword",
each if List.Contains(Keywords, Text.Trim(Text.Lower([YourColumnName]))) then "Yes" else "No"
)
in
AddedCustom
let me know if you want support in adapting your code. If it's ok, please accept my answer as solution.
BBF