Power Query Splitter.SplitTextByEachDelimiter Guide
In this article
Splitter.SplitTextByEachDelimiter splits a text value into a list of parts using a series of delimiters in order, each one applied to the next remaining piece of text. It is the function you reach for when a single string contains several different separators in a fixed sequence, such as a log line, a packed code like ABC-123/456, or a full name field that stores surname, first name and title separated by commas and slashes. It ships as part of the M splitter library inside Power Query in Power BI Desktop, Excel's Get & Transform, and the Power Query Online service, so you do not install anything separately.
What You'll Need
- A Power Query environment: Power BI Desktop, Excel with Power Query, or Power Query Online. Menu names can differ slightly between these products, their versions and regional settings, but the M function itself behaves the same.
- The Power Query Editor open with at least one query, or a blank query where you can paste M code through Home > Advanced Editor.
- A text column that contains multiple different delimiters you want to peel off in a known order.
- Enough familiarity with the M language to type or edit a formula, because this function is generally written by hand rather than chosen from the ribbon.
Step-by-Step
- Open your query in the Power Query Editor. Decide exactly which delimiters appear in the text and the order in which they appear, from left to right. Write the sequence down, for example hyphen first, then forward slash.
- Confirm the column name. Select the column and note its exact header, because you will reference it in the formula. If you prefer, rename it first so the reference is short and readable.
- Add a custom column with Home > Custom Column, or edit the existing step in the Advanced Editor. In the formula box, start with
Splitter.SplitTextByEachDelimiterand give it the delimiter list:Splitter.SplitTextByEachDelimiter({"-", "/"}). The curly braces create an M list, and the order of the items is the order the delimiters are applied. - Wrap the function in a call that applies it to your column. The pattern is
Splitter.SplitTextByEachDelimiter({ "-", "/ "})([YourColumn]). The function returns a splitter function first, and the second set of parentheses is what actually runs it on a value. A common custom column expression looks likeSplitter.SplitTextByEachDelimiter({ "-", "/ "})([Codes]). - Add the optional fourth argument only if you need it.
Splitter.SplitTextByEachDelimiter(delimiters, quoteStyle, startAtEnd)accepts aQuoteStylevalue such asQuoteStyle.Csvand a logicalstartAtEndflag. Leaving them out uses the defaults, quote style unknown and splitting from the left. - Check the return type in the preview. The result is a list, shown as
Listin the column header. If you see something else, or an error, fix the formula before continuing. - Expand the list into columns. Click the expand icon next to the new column header and choose Extract Values, or use Transform > Extract. Pick a delimiter for joining, or expand to new rows if you prefer one value per row. The result is the parsed pieces in order.
- Rename the resulting columns immediately so the next steps stay readable. Then set a data type per column with the type icon in the header, since extracted values arrive as text by default.
- Test the edge cases before you rely on the query. Add a row with fewer delimiters than expected and a row with more, refresh, and confirm the output matches what you want. The function splits only as many times as there are delimiters in your list, so extra delimiters stay inside the last part.
Common Mistakes
The most frequent error is passing a single text string instead of a list. Splitter.SplitTextByEachDelimiter("-,/") does not split on either character. Each delimiter must be its own list item: {"-", "/"}.
A second mistake is calling the function once and expecting a result. The first call returns a function, so you need the second argument list with your text value. Without it you get a function value in the column, not a list.
Order matters, and it is easy to assume otherwise. The delimiters are applied sequentially to the remaining text, not searched in parallel. If your data uses the same delimiter twice, and your list only names it once, the second occurrence remains in the final part.
Forgetting that delimiters are matched as whole strings is another trap. Multi-character delimiters work, but a delimiter like "::" will not match a single colon, so mixed colon patterns need separate entries.
Finally, people expand the list and hard-code column names, then the query breaks when a row produces more parts than expected. Set explicit types and handle the extra columns deliberately.
Tips
Use Text.Split when all delimiters are interchangeable and order does not matter. Reach for Splitter.SplitTextByEachDelimiter specifically when the sequence is meaningful, such as separating a prefix, a code and a suffix.
Keep the delimiter list in a separate query or a variable at the top of your script so a format change only needs one edit. In M you can define it as a step and reference it, which keeps the custom column short.
If your text contains quoted sections with delimiters inside the quotes, pass QuoteStyle.Csv so the splitter respects the quotes. Test with a sample containing commas inside quotation marks before trusting it on real data.
Set startAtEnd to true when the delimiter sequence is more reliable from the right, for example when a file name has a variable number of leading segments but a fixed structure at the end.
Name your expanded columns straight away and add a comments step later in the script, since a complicated split is hard to reconstruct months later.
Troubleshooting
If the custom column shows Error, select the cell to read the message. The usual cause is a missing column reference, a typo in the column name including its case and spacing, or a text value of null. Wrap the expression with try ... otherwise to catch nulls: try Splitter.SplitTextByEachDelimiter({"-"})([Col]) otherwise null.
If the column shows a function symbol instead of List, you stopped after the first set of parentheses. Add the second argument list with the text value.
If the split produces fewer parts than expected, check the delimiter order and confirm each delimiter is a separate list item. If it produces more parts than your expanded columns allow, adjust the expansion so extra columns are not dropped silently; expand with a fixed number of columns only after you have checked the maximum count in the data.
If the query is slow on a large table, the splitter runs row by row in the engine. Reducing the number of custom columns and using Table.SplitColumn or a single transformation can help, and so can filtering out blank rows before the split.
If results differ after a refresh, the source data likely changed shape. Compare a known row against the source, confirm the delimiter list still matches, and re-check the type step, since a type change can turn a text value into something the splitter cannot process.
Frequently Asked Questions
Does Splitter.SplitTextByEachDelimiter split on all delimiters at once?
No. It applies each delimiter in sequence to the remaining text, so the order in the list matters and the output length is tied to how many delimiters you supply.
Can I use multi-character delimiters?
Yes, any string works as a delimiter, including multi-character sequences, and the whole string must match to trigger a split.
What is the difference from Text.Split?
Text.Split treats every listed delimiter the same and does not apply them in order. The splitter function is for a defined delimiter sequence.
How do I handle null values in the column?
Wrap the expression in try ... otherwise or filter nulls before the step, otherwise the function returns an error for those rows.
Can I split from the right instead of the left?
Yes, set the startAtEnd argument to true, which applies the delimiter sequence from the end of the text.