Excel Power Query Concatenate Text: Step-by-Step Guide
In this article
To concatenate text in Power Query, use the Text.Combine function or the Merge Columns button on the Transform tab. Both combine multiple text fields into one, but Text.Combine is more flexible for custom delimiters and conditional logic. You do not need any special add-in; Power Query is built into Excel 2016 and later (and available as a free add-in for Excel 2010/2013).
What You'll Need
- Excel 2016 or later (Power Query is on the Data tab as "Get & Transform Data"). For Excel 2010/2013, install the Microsoft Power Query add-in from Microsoft's official download page.
- A table of data with at least two text columns you want to combine (e.g., First Name and Last Name).
- Basic familiarity with the Power Query Editor: loading data, adding steps, and closing & loading.
Step-by-Step
- Load your data into Power Query. Select any cell in your table, then go to Data > From Table/Range (or Get Data > From Other Sources > Blank Query and paste data). The Power Query Editor opens. Menu labels can differ slightly by Excel version and region.
- Choose your columns. In the editor, Ctrl-click the column headers you want to concatenate (e.g., First Name and Last Name). The order you click determines the order of the combined text. To reorder, drag column headers left or right before combining.
- Option A: Use Merge Columns (quickest). With the columns selected, go to Transform > Merge Columns. In the dialog, pick a separator from the dropdown (Comma, Semicolon, Space, Tab, or Custom). For a custom separator like " - ", choose Custom and type it. Give the new column a name, then click OK. Power Query adds a step that combines the selected columns and removes the originals.
- Option B: Use Text.Combine (more control). Go to Add Column > Custom Column. In the formula box, enter a formula such as:
Text.Combine({[First Name], [Last Name]}, " ")This joins the two fields with a space. For three fields:Text.Combine({[First], [Middle], [Last]}, " "). Click OK. A new column appears with the combined text. This method keeps the original columns intact. - Handle blanks and nulls. Text.Combine ignores null values but keeps empty strings. If a middle name is null, the result will be "John Doe" (no extra space). If you want a placeholder, wrap each field in
if [Field] = null then "" else [Field]inside the list, or useText.Combine(List.Transform({[First], [Last]}, each if _ = null then "" else _), " "). - Preview and adjust. Check the new column in the data preview. If the order is wrong, edit the step in the Applied Steps pane (click the gear icon next to the step) or reorder columns before merging. If you used Merge Columns and lost original columns, you can delete the step and redo, or use Text.Combine instead.
- Close and load. Go to Home > Close & Load (or Close & Load To... to choose a worksheet or data model). The combined column appears in your Excel workbook.
Common Mistakes
- Forgetting to select columns in the right order. Merge Columns uses the order you clicked; if Last Name is first, you get "Doe John". Always Ctrl-click in the desired order or drag headers first.
- Using Merge Columns when you need originals. Merge Columns removes the source columns by default. If you need them later, use Add Column > Custom Column with Text.Combine instead.
- Ignoring nulls. Text.Combine skips nulls, which can produce double spaces if you manually add separators. Use a conditional or List.Transform to replace nulls with empty strings.
- Mixing data types. Text.Combine requires text values. If a column is numeric, convert it first with Transform > Data Type > Text , or use inside the formula.
- Hardcoding column names that change. If your source headers vary, use
Text.Combine(Record.FieldValues(_), " ")carefully, or reference columns by position withTable.ColumnNamesandTable.Column.
Tips
- Use a custom separator like " | " or " - " for readability. In Merge Columns, choose Custom and type it; in Text.Combine, put it as the second argument.
- To concatenate all text columns in a row dynamically, add a custom column with
Text.Combine(List.Transform(Record.FieldValues(_), each if _ = null then "" else Text.From(_)), ", "). Be careful: this includes every column, so filter or select first. - For conditional concatenation (e.g., only combine if both fields are non-empty), use
if [First] <> null and [Last] <> null then Text.Combine({[First], [Last]}, " ") else null. - Name your steps clearly in the Applied Steps pane (right-click > Rename) so you can debug later.
- Test with a small sample before applying to large datasets; Power Query steps are applied to all rows.
Troubleshooting
- Error: "We cannot convert the value null to type Text." A column contains nulls. Wrap each field with
if [Field] = null then "" else [Field]or useText.Fromafter replacing nulls. - Merged column shows numbers instead of text. The source column is numeric. Change its data type to Text before merging, or use
Text.From([Column])in the formula. - Separator not appearing. In Merge Columns, ensure you selected a separator (not "None"). In Text.Combine, the second argument must be a text string in quotes.
- Original columns disappeared. You used Merge Columns, which removes them. Delete that step and use Add Column > Custom Column with Text.Combine, or duplicate the columns first.
- Formula syntax error. Check curly braces
{ }for the list of fields, commas between arguments, and double quotes around text. Field names with spaces need square brackets:[First Name]. - Changes not showing in worksheet. Click Home > Refresh All (or right-click the query > Refresh). If still missing, check that you loaded to the correct location via Close & Load To.
Frequently Asked Questions
Can I concatenate more than two columns?
Yes. In Merge Columns, Ctrl-click any number of columns. In Text.Combine, list them all inside the curly braces: Text.Combine({[A], [B], [C]}, " ").
How do I add a line break between concatenated values?
Use the character sequence #(lf) as the separator: Text.Combine({[First], [Last]}, "#(lf)"). In Merge Columns, choose Custom and type #(lf).
Does Text.Combine work with numbers and dates?
Only if you convert them to text first. Use or change the column data type to Text before combining.
What is the difference between Merge Columns and Text.Combine?
Merge Columns is a one-click transformation that removes the original columns. Text.Combine is a function used in a custom column that keeps originals and offers more control over nulls and separators.
Can I undo a merge?
Yes. In the Applied Steps pane, click the X next to the merge step to delete it, or press Ctrl+Z immediately after merging. If you already closed and loaded, edit the query to remove the step and refresh.
Why does my combined column show "Error" for some rows?
Likely a null or non-text value. Check the column data types and replace nulls with empty strings using the conditional formula shown above.