<!-- https://learnsql.cpetoday.com/functions/m/text-split -->
# Text.Split

Language: Power Query M
Category: Text
Syntax: Text.Split(text as nullable text, separator as text) as list
Summary: Splits a text value into a list of pieces at each separator.
Returns: A list of text values, one for each piece.
Level: Intermediate
Related: Text.Combine, Text.BeforeDelimiter, Text.AfterDelimiter, Splitter.SplitTextByDelimiter, List.Transform

## What it does
Text.Split breaks one value into a list at a separator you name. A remittance advice that lists several invoices in one field, such as "INV1043|INV1044|INV1047", becomes three invoice numbers that can be matched one at a time. The result is a list, not a table, so a step is usually needed to turn it into rows.
## Syntax and arguments
- text: the value to split.
- separator: the text where each split happens. The separator is removed from the result.
## Example
A customer paid three invoices with one wire, and the remittance field lists them separated by a vertical bar. The team lists them one per row so each can be matched to an open invoice.

```powerquery
let
    Payments = #table(type table [PaymentId = text, Invoices = text],
        {{"P-551", "INV1043|INV1044|INV1047"}, {"P-552", "INV1051"}}),
    Split = Table.AddColumn(Payments, "InvoiceList", each Text.Split([Invoices], "|"), type list),
    Expanded = Table.ExpandListColumn(Split, "InvoiceList"),
    Rows = Table.RemoveColumns(Expanded, {"Invoices"})
in
    Rows
```

P-551 becomes three rows and P-552 stays one row, so the result has four rows, each with one invoice number in InvoiceList. The payment id repeats on each row so the team can see the full payment.
## Example: a second, different use
Split a cost center path such as "Dept-100/Region-West" into its parts with "/" to get the department and the region separately.
## Things to watch
- The result is a list. Table.ExpandListColumn turns it into rows, and Table.ExpandListColumn is the step most people miss.
- Empty pieces are kept. A trailing separator gives an empty last item, so trim and filter it out.
- The separator is case sensitive text, and it is matched exactly.
- Null in gives null out, and a null in a list column breaks later steps.
## In business terms
Remittances, batch headers and multi-line memos often pack several items into one field. Splitting that field into rows is how a team matches one customer payment against several open invoices.
