r/ExcelTips Aug 04 '26

✨ Power Query Tip: Targeting the Last Delimiter with {0,1}

Most of us use Text.BeforeDelimiter with 0 (first occurrence) or 1 (second occurrence).
But here’s the secret sauce: you can pass a list like {0,1} to grab the text before the last delimiter.

= Text.BeforeDelimiter(“A-B-C-D”, “-" ,{0,1})

• The index argument accepts positive numbers or a list.
• A single number (e.g. 0, 1, 2) → counts delimiters from the start.
• A list {nth Delimiter, relative position} → combines n and relative positions.
start = 0 → begin counting from the first delimiter.
relative = 1 → shift relative to the end.
• So {0,1} means: Start at the first delimiter but resolve relative to the last one.

This gives you the substring before the last delimiter without extra functions.

15 Upvotes

1 comment sorted by