Text.AfterDelimiter
Returns the part of a text value that comes after a delimiter.
Text.AfterDelimiter(text as nullable text, delimiter as text, optional index as any) as nullable textReturns: 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
- text: the value to read from.
- delimiter: the text that marks the split, matched exactly.
- index (optional): chooses which occurrence of the delimiter to use. Leave it out for the first.
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
- It returns text after the first delimiter. A name with its own dash, such as "Ledger-Adj-Q3", keeps everything after the first dash.
- Spaces around the delimiter stay unless you trim them.
- Labels with no separator at all do not split cleanly, so check for them before you rely on the result.
- Null in gives null out.
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.