Forum Discussion

laganlee's avatar
laganlee
Helper II
3 years ago
Solved

Conditional column: Determine if a list value is contained in part of row in a column.

Hi,

 I need to see if any values in a list appear in one column of a table.

 

I have got near with: if List.Contains(#"Animals",[Project Num]) then "yes" else "no"

but it misses out if the row contains other values i.e. row 1 

It has to search inside the row to see if it exists within that row.

There is the Text.Contains which might help:

  each if Text.Contains([Animal], "Cat") then "yes" else "no")

My actual list is 250, so I don't want to type each value in!

 

Would anybody have a solution?

Many thanks for looking.

  • List.Contains(#"Animals",[Project Num],(x,y)=>List.Contains(Text.SplitAny(y," ,"),x))

2 Replies

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Community Champion

    List.Contains(#"Animals",[Project Num],(x,y)=>List.Contains(Text.SplitAny(y," ,"),x))

    • laganlee's avatar
      laganlee
      Helper II

      Hi Daniel

      That worked great!

      Many thanks 🙂