Text.SplitAny

Text

Splits a text value at any character found in the separators string, returning a list of substrings.

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

Syntax

Text.SplitAny(text as text, separators as text) as list

Parameters

NameTypeRequiredDescription
texttextYesThe text value to split.
separatorstextYesA text value whose individual characters are each treated as a delimiter.

Return Value

listA list of text values split at any occurrence of any character in separators.

Remarks

Text.SplitAny splits text at every occurrence of any character found in the separators string. Each character in separators is treated as an independent single-character delimiter — not as a multi-character substring to match. This is the key difference from Text.Split, which treats the entire second argument as one delimiter.

For example, Text.SplitAny("a,b;c", ",;") splits on both , and ; independently, producing {"a", "b", "c"}. In contrast, Text.Split("a,b;c", ",;") would look for the exact two-character sequence ",;" and return the original string unsplit if that sequence does not appear.

Consecutive separator characters produce empty strings in the result list. If your source data may have multiple consecutive separators (such as double spaces or mixed delimiters), filter the result with List.Select(result, each _ <> "") to remove empty entries.

A notable application of Text.SplitAny is collapsing internal spaces: Text.Combine(Text.SplitAny(text, " "), " ") splits on spaces and rejoins with a single space, effectively collapsing runs of multiple spaces. Text.Trim alone does not remove internal duplicate spaces — this pattern is the standard workaround.

Examples

Example 1: Split on multiple delimiter characters

Text.SplitAny("East,West;North", ",;")
Result
Result
1East,West,North

Example 2: Normalize multiple internal spaces in a name

Text.Combine(Text.SplitAny("alice  smith", " "), " ")
Result
Result
1alice smith

Example 3: Split a path that uses mixed separators

Text.SplitAny("C:/Users\\Kyle/Documents", "/\\")
Result
Result
1C:,Users,Kyle,Documents

Example 4: Filter empty entries produced by consecutive separators

let
    raw = "Sales,,East,,Q1",
    parts = Text.SplitAny(raw, ","),
    nonEmpty = List.Select(parts, each _ <> "")
in
    nonEmpty
Applied Steps

The final output — filters the list with List.Select to remove all empty strings, leaving only the three non-empty segments.

Result
1Sales,East,Q1

Compatibility

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