List.MatchesAny

List

Returns true if the condition function returns true for at least one item in the list.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

List.MatchesAny(list as list, condition as function) as logical

Parameters

NameTypeRequiredDescription
listlistYesThe list to test.
conditionfunctionYesA function that takes a list item and returns a logical value.

Return Value

logicalTrue if the condition returns true for at least one item; false if no items satisfy the condition.

Remarks

List.MatchesAny applies a condition (predicate) function to each item in a list and returns true as soon as any item satisfies the condition. It is the list equivalent of the existential quantifier — "there exists at least one item for which the condition holds."

Unlike List.AnyTrue, which expects a pre-built list of logical values, List.MatchesAny accepts any list and evaluates the predicate inline. This makes it the cleaner choice when working directly with data: List.MatchesAny(Products[InStock], each _ = true) is more readable than wrapping List.Transform.

An empty list returns false. The function short-circuits as soon as a passing item is found, so it can be efficient on large lists when an early match is likely. For simple equality checks (does any item equal this value?), List.Contains is more idiomatic. Use List.MatchesAny for composite or calculated conditions that go beyond simple equality.

Examples

Example 1: Check if any number exceeds a threshold

List.MatchesAny({10, 25, 5, 8}, each _ > 20)
Result
Result
1TRUE

Example 2: No items match

List.MatchesAny({1, 2, 3}, each _ > 10)
Result
Result
1FALSE

Example 3: Check if any product is out of stock

let
    StockLevels = {100, 0, 45, 230, 0},
    HasOutOfStock = List.MatchesAny(StockLevels, each _ = 0)
in
    HasOutOfStock
Applied Steps

The final output — checks whether any stock level equals zero, returning true because two products have no stock.

Result
1TRUE

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks