Splitter.SplitTextByEachDelimiter

Splitter

Returns a function that splits text using a different delimiter at each split position.

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

Syntax

Splitter.SplitTextByEachDelimiter(delimiters as list, optional quoteStyle as nullable number, optional startAtEnd as nullable logical) as function

Parameters

NameTypeRequiredDescription
delimiterslistYesA list of text delimiters. The first delimiter is used for the first split, the second for the next split, and so on.
quoteStylenumberNoA QuoteStyle value specifying how to handle quoted sections. Defaults to QuoteStyle.None.
startAtEndlogicalNoIf true, splits are applied starting from the end of the text. Defaults to false.

Return Value

functionA function that takes a text value and returns a list of text parts, using a different delimiter for each successive split.

Remarks

Splitter.SplitTextByEachDelimiter returns a function that applies a sequence of delimiters in order. The first delimiter splits the text into two parts, the second delimiter splits the remainder, and so on. The number of resulting parts is always one more than the number of delimiters.

Set startAtEnd to true to apply delimiters from right to left, which is useful for splitting text where the last portions have a known structure but earlier parts may contain the delimiter.

Examples

Example 1: Split formatted text with positional delimiters

let
    Source = Table.AddColumn(
        Table.FirstN(Sales, 3),
        "Combo", each [CustomerName] & " - " & [Product] & " / " & [Region], type text
    ),
    SplitFn = Splitter.SplitTextByEachDelimiter({" - ", " / "})
in
    Table.SelectColumns(
        Table.SplitColumn(
            Table.SelectColumns(Source, {"Combo"}),
            "Combo", SplitFn, {"Name", "Product", "Region"}
        ),
        {"Name", "Product", "Region"}
    )
Result
Name
Product
Region
1AliceWidget AEast
2BobGadget BWest
3CharlieWidget CEast

Compatibility

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