Forum Discussion
amineregask
5 years agoNew Member
Count number of text cells containing string, for each string in a table column
Hi everyone, I would need your help on the following case. I have 2 tables: Table 1: contains a column with a list of countries Table 2: contains a column with text elements I would like to ...
- Anonymous5 years ago
Hi amineregask
You need to remove that "each" after "Custom", before (X)=>
= Table.AddColumn(#"Changed Type1", "Custom", (x)=> List.Count(List.Select(Table2[Text], each Text.Contains(_,x[Country]))))Anonymous the way seems better, but there is a typo, you can try like this
Table.AddColumn(#"Changed Type1", "Custom", each List.Count(List.FindText(Table2[Text],[Country])))
amineregask
5 years agoNew Member
Hi Anonymous thanks a lot for your quick reply!
When I create the custom column, I get "function" values in it. Did I miss any step?
Thank you!
Anonymous
5 years agoNot applicable
Hi amineregask
You need to remove that "each" after "Custom", before (X)=>
= Table.AddColumn(#"Changed Type1", "Custom", (x)=> List.Count(List.Select(Table2[Text], each Text.Contains(_,x[Country]))))
Anonymous the way seems better, but there is a typo, you can try like this
Table.AddColumn(#"Changed Type1", "Custom", each List.Count(List.FindText(Table2[Text],[Country])))- amineregask5 years agoNew Member
Hi Anonymous Anonymous
Both solutions work, many thanks!!