List.FindText
ListReturns all items in the list that contain the given text string. Items must be text values; comparison is case-insensitive.
Syntax
List.FindText(list as list, text as text) as listParameters
| Name | Type | Required | Description |
|---|---|---|---|
list | list | Yes | The list of text values to search. |
text | text | Yes | The text string to search for within each list item. |
Return Value
list — A list of text items from the source list that contain the given text.
Remarks
List.FindText filters a list of text values, returning only those that contain the specified text as a substring. The search is case-insensitive — "apple" will match "Apple", "APPLE", and "pineapple".
All items in the list must be text values; non-text values (including null) will cause an error. If your list may contain mixed types, use List.Select with a guarded Text.Contains call instead. Returns an empty list if no items match.
List.FindText is equivalent to List.Select(list, each Text.Contains(_, text, Comparer.OrdinalIgnoreCase)). Use List.Select directly when you need case-sensitive matching, more complex conditions (e.g., starts-with or ends-with), or when working with lists that may contain non-text values. List.FindText is most useful as a quick, readable substring filter on a clean list of text.
Examples
Example 1: Find items containing "apple"
List.FindText({"Apple Juice", "Orange Soda", "Pineapple Tart", "Grape Jam"}, "apple")Result | |
|---|---|
| 1 | {Apple Juice, Pineapple Tart} |
Example 2: Search product codes
let
Products = {"PROD-001", "ITEM-002", "PROD-003", "SVC-004", "PROD-005"},
ProdItems = List.FindText(Products, "PROD")
in
ProdItemsThe final output — uses List.FindText to return only those product codes that contain the substring "PROD".
Result | |
|---|---|
| 1 | {PROD-001, PROD-003, PROD-005} |
Example 3: Case-insensitive matching
List.FindText({"Alpha", "BETA", "gamma", "Delta"}, "a")Result | |
|---|---|
| 1 | {Alpha, gamma, Delta} |