Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Syntax
List.Contains(list as list, value as any, optional equationCriteria as any) as logical
About
Indicates whether the list contains the specified value. Returns true
if the value is found in the list, false
otherwise.
list
: The list to search.value
: The value to search for in the list.equationCriteria
: (Optional) The comparer used to determine if the two values are equal.
Example 1
Determine if the list {1, 2, 3, 4, 5} contains 3.
Usage
List.Contains({1, 2, 3, 4, 5}, 3)
Output
true
Example 2
Determine if the list {1, 2, 3, 4, 5} contains 6.
Usage
List.Contains({1, 2, 3, 4, 5}, 6)
Output
false
Example 3
Ignoring case, determine if the list contains "rhubarb".
Usage
List.Contains({"Pears", "Bananas", "Rhubarb", "Peaches"},
"rhubarb",
Comparer.OrdinalIgnoreCase
)
Output
true
Example 4
Determine if the list contains the date April 8, 2022.
Usage
let
Source = {#date(2024, 2, 23), #date(2023, 12, 2), #date(2022, 4, 8), #date(2021, 7, 6)},
ContainsDate = List.Contains(Source, Date.From("4/8/2022"))
in
ContainsDate
Output
true