A column that holds first name and last name together cannot be sorted by surname, and a code column that holds size and colour together cannot be filtered by either. Power Query splits a column on a delimiter such as a comma or a space, and the split can be re-run when the data refreshes.
Prerequisites
- Excel with Power Query
- A table with a combined column, such as full name
- A copy of the source file, so the original stays untouched.
Steps
- Select the table and go to Data, From Table/Range to open it in the Power Query Editor.
- Select the combined column, then go to Home, Split Column, By Delimiter.
- Pick the delimiter, such as a space or a comma, and choose to split at each occurrence.
- Rename the new columns, for example First name and Last name, and check rows where the name has more parts than expected.
- Click Close and Load, then spot-check five rows against the original column.
Worked example: Fictional full names split into first and last name
The practice table below is a fictional five-person list after splitting. The count column is 1 per person, and the total is the number of people. The table below is fictional practice material, with fictional values. It is the expected result, worked out by hand, not a run of any tool.
| First name | Last name | Count |
|---|---|---|
| Amara | Okafor | 1 |
| Ben | Whitfield | 1 |
| Clara | Jensen | 1 |
| Dev | Patel | 1 |
| Elena | Rossi | 1 |
| Total | 5 |
Expected result. Five names split, each first and last name in its own column, and the count is 5.
Limits
- A name with two first names or a double surname will split into more parts than expected, so check those rows.
- Splitting does not change the source data, so the original combined column stays in the source.
