Downloads
Power Query MTextBeginner

Text.AfterDelimiter

Returns the part of a text value that comes after a delimiter.

Syntax
Text.AfterDelimiter(text as nullable text, delimiter as text, optional index as any) as nullable text

Returns: The text after the first delimiter (or the chosen one), or null when the input is null.

What it does

Text.AfterDelimiter keeps the part after a separator. It is the partner of Text.BeforeDelimiter. Together they split a label such as "1000-Cash" into the code "1000" and the name "Cash". Text.AfterDelimiter returns everything after the first occurrence of the delimiter by default.

Syntax and arguments

Example

The same chart of accounts label is split into a code and a name, so the report can show the name next to the number.

let
    Label = "1000-Cash",
    Code = Text.BeforeDelimiter(Label, "-"),
    Name = Text.Trim(Text.AfterDelimiter(Label, "-"))
in
    {Code, Name}

The result is {"1000", "Cash"}. Text.Trim removes any space that follows the dash, so a label written as "1000 - Cash" would also give "Cash".

Example: a second, different use

Read the reference from a memo such as "Ref: INV1043". The text after the colon is " INV1043", so Text.Trim gives "INV1043".

Things to watch

In business terms

Labels that carry a code and a name are everywhere in finance data: accounts, cost centers, projects and products. Splitting them with a pair of functions, one for each side, keeps the code for joins and the name for reports.

Related functions

All Power Query M functions · View as Markdown · M basics