<!-- https://learnsql.cpetoday.com/functions/m/splitter-splittextbyeachdelimiter -->
# Splitter.SplitTextByEachDelimiter

Language: Power Query M
Category: Splitters and combiners
Syntax: Splitter.SplitTextByEachDelimiter(delimiters, optional quoteStyle, optional startAtEnd)
Summary: Returns a splitter that cuts text at each of several delimiters in turn, using a list of delimiter values.
Returns: A function that you pass to a split step. It returns a list of pieces.
Level: Intermediate
Related: Splitter.SplitTextByDelimiter, Splitter.SplitTextByPositions, Combiner.CombineTextByDelimiter, Splitter.SplitByNothing, Replacer.ReplaceText

## What it does
Splitter.SplitTextByEachDelimiter works like Splitter.SplitTextByDelimiter, but takes a list of delimiters. Power Query applies them one after another, so the text is cut at each one in turn. Use it when a text field can be separated by more than one kind of mark, such as a mix of commas and semicolons in a memo.

## Syntax and arguments
- `delimiters`: a list of delimiter values, such as `{";", ","}`. The order you give them is the order they are applied.
- `quoteStyle` (optional): how quoted text is handled, as in Splitter.SplitTextByDelimiter.
- `startAtEnd` (optional): when true, the cutting starts from the end of the text rather than the start.

## Example
A memo field from an older system holds several references separated by a mix of semicolons and commas. The team needs each reference on its own line.

```powerquery
let
    Memo = "INV-4471;INV-4472,INV-4475",
    Pieces = Splitter.SplitTextByEachDelimiter({";", ","})(Memo),
    Trimmed = List.Transform(Pieces, Text.Trim)
in
    Trimmed
```

`Pieces` is the list of three references: INV-4471, INV-4472 and INV-4475. The second pair of brackets calls the splitter on the memo. Trimming removes any stray spaces.

## Example: a second, different use
Splitting a column in a table with `Table.SplitColumn(Source, "Memo", Splitter.SplitTextByEachDelimiter({";", ","}))`, which creates one column per piece.

## Things to watch
- The delimiters are applied in order. Check the result on a few real rows, because a delimiter that appears inside a value will cut it too.
- Splitting into a list makes many pieces. Expect the number of columns to change when a memo has a different count.
- Trim the pieces. A space after a comma becomes part of the next value.
- For one delimiter only, Splitter.SplitTextByDelimiter is simpler.

## In business terms
Memo and reference fields that hold several invoice or check numbers are common in receivables and cash application. Splitting them into one row per reference lets each invoice be matched to a payment.
