Power Query course · Lesson 5 of 17
Splitting and merging columns
Split columns by delimiter, number of characters, positions or character transitions, split into rows, and merge columns with a separator.
Source systems love to pack several facts into one column (Lopez, Maria, SKU-2231-RED-L, Athens 10558) or to scatter one fact over several columns (Street, No, City, Postcode). Power Query's Split Column and Merge Columns commands fix both problems. They are the repeatable, more flexible versions of Excel's Text to Columns wizard and of formulas such as TEXTSPLIT, TEXTJOIN and CONCAT.
Split by delimiter
A delimiter is a character that separates the parts, such as a comma, a hyphen or a space. Select the column and choose Home › Split Column › By Delimiter (also on Transform › Split Column and on the right-click menu). The dialog asks:
- Select or enter delimiter: Colon, Comma, Equals Sign, Semicolon, Space, Tab, or --Custom-- for any text, even several characters like
/. - Split at: Left-most delimiter (two parts, split at the first occurrence), Right-most delimiter (two parts, split at the last occurrence) or Each occurrence of the delimiter (as many parts as needed).
- Advanced options: split into Columns or Rows, the Number of columns to split into, the Quote Character (so a comma inside quotes is not a split point) and Split using special characters for tabs and line breaks.
| A | B | C | |
|---|---|---|---|
| 1 | Employee | Department | Location |
| 2 | Lopez, Maria | Finance | Madrid / ES |
| 3 | Becker, Tom | Sales | Hamburg / DE |
| 4 | Tanaka, Aiko | IT | Lisbon / PT |
| 5 | Van der Berg, Jan | Sales | Utrecht / NL |
Before: an HR list with last and first name in one column and city plus country code in another.
- Select
Employee› Split Column › By Delimiter › --Custom--,(comma and space) › Left-most delimiter › OK. - Rename the new columns
Employee.1andEmployee.2toLast nameandFirst nameby double-clicking the headers. - Select
Location› Split Column › By Delimiter › --Custom--/› Each occurrence of the delimiter › OK, and rename toCityandCountry.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Last name | First name | Department | City | Country |
| 2 | Lopez | Maria | Finance | Madrid | ES |
| 3 | Becker | Tom | Sales | Hamburg | DE |
| 4 | Tanaka | Aiko | IT | Lisbon | PT |
| 5 | Van der Berg | Jan | Sales | Utrecht | NL |
After: one fact per column. Splitting at the left-most comma keeps 'Van der Berg' together because the spaces inside it are not the delimiter.
= Table.SplitColumn(Source, "Employee", Splitter.SplitTextByEachDelimiter({", "}, QuoteStyle.Csv, false), {"Last name", "First name"}){"Employee.1", "Employee.2"} in the formula bar. That saves a separate Renamed Columns step.Split into rows
Sometimes a cell holds a list: an employee's skills Excel, SQL, Python, or an order's coupon codes. To analyse the items you want one row per item. In the By Delimiter dialog open Advanced options and choose Split into Rows.
| A | B | |
|---|---|---|
| 1 | Employee | Skills |
| 2 | Maria Lopez | Excel, SQL |
| 3 | Tom Becker | Negotiation |
| 4 | Aiko Tanaka | Python, SQL, Power BI |
Before: several skills in one cell.
| A | B | |
|---|---|---|
| 1 | Employee | Skills |
| 2 | Maria Lopez | Excel |
| 3 | Maria Lopez | SQL |
| 4 | Tom Becker | Negotiation |
| 5 | Aiko Tanaka | Python |
| 6 | Aiko Tanaka | SQL |
| 7 | Aiko Tanaka | Power BI |
After: Split into Rows with delimiter ', '. Now a PivotTable can count how many people know SQL.
= Table.ExpandListColumn(Table.TransformColumns(Source, {{"Skills", Splitter.SplitTextByDelimiter(", ", QuoteStyle.Csv)}}), "Skills")Split by number of characters and by positions
Fixed-width exports from older systems put each field at a fixed place in the line. Two commands handle them:
- Split Column › By Number of Characters: for example
2characters Repeatedly, or Once, as far left as possible. Splitting a postcode-plus-city text like10558Athensonce after 5 characters gives10558andAthens. - Split Column › By Positions: a comma-separated list of starting positions, counted from 0.
0, 8, 14splits20260315SO5512Shippedinto20260315,SO5512andShipped.
Split by character transition
Four more options split where the kind of character changes: By Lowercase to Uppercase, By Uppercase to Lowercase, By Digit to Non-Digit and By Non-Digit to Digit. BoxSize40 split by non-digit to digit gives BoxSize and 40; MariaLopez split by lowercase to uppercase gives Maria and Lopez. They are rarely needed, but when a product code mixes letters and numbers they save a custom formula.
Merging columns
Merging is the opposite: several columns become one text column. Select the columns in the order you want them joined (click the first, Ctrl+click [Cmd+click on Mac] the others), then choose:
- Transform › Merge Columns to replace the selected columns with the merged one, or
- Add Column › Merge Columns to keep them and add the merged column.
Pick a Separator (Colon, Comma, Equals Sign, Semicolon, Space, Tab or Custom) and type a New column name. Numbers and dates are converted to text automatically.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Region | Store | Year | Month |
| 2 | EU | ATH01 | 2026 | 3 |
| 3 | EU | LIS02 | 2026 | 3 |
| 4 | NA | BOS01 | 2026 | 3 |
Before: the parts of a report key in separate columns.
| A | B | C | |
|---|---|---|---|
| 1 | Store key | Year | Month |
| 2 | EU-ATH01 | 2026 | 3 |
| 3 | EU-LIS02 | 2026 | 3 |
| 4 | NA-BOS01 | 2026 | 3 |
After: Region and Store merged with the custom separator '-' into Store key, ready to match a store master list.
= Table.CombineColumns(Source, {"Region", "Store"}, Combiner.CombineTextByDelimiter("-", QuoteStyle.None), "Store key")EU- with a trailing separator, or no separator at all. Replace nulls with a placeholder first (Transform › Replace Values, value to find null) if every key must have the same structure.Merging with a custom formula
For more control, for example to build an invoice number like INV-2026-0007 with zero padding, use Add Column › Custom Column and a formula:
= Table.AddColumn(#"Changed Type", "Invoice no", each "INV-" & Text.From([Year]) & "-" & Text.PadStart(Text.From([Seq]), 4, "0"), type text)Unlike Excel, M does not convert numbers to text automatically when you use &: "INV-" & 2026 is an error. Text.From is the fix. Custom columns are covered fully in Custom and conditional columns.
Choosing the right tool
| Situation | Command |
|---|---|
| Last, First in one column | Split By Delimiter, Left-most |
| Path or category tree, need the last part | Split By Delimiter, Right-most, or Extract › Text After Delimiter |
| List of items in one cell | Split By Delimiter, Advanced, into Rows |
| Fixed-width text file | Split By Positions |
| Build a key from several fields | Merge Columns, or Custom Column with Text.From |
Check yourself
1. You need to split 'Van der Berg, Jan' into last and first name. Which setting is right?
Splitting at the first comma-space keeps the multi-word last name together.
2. How do you get one row per skill from 'Excel, SQL'?
Split into Rows creates a row for each item and copies the other columns.
3. Which tab keeps the original columns when merging?
Add Column › Merge Columns adds a new column and keeps the originals.
4. In M, what does "INV-" & 2026 return?
M does not convert numbers to text implicitly; use Text.From.
5. Split By Positions uses positions counted from…
Positions in Power Query are zero-based.