You are learning Power Query in MS Excel
How to split a single column into multiple columns based on delimiters in Power Query?
In Power Query, you can split a single column into multiple columns based on delimiters (such as commas, semicolons, tabs, etc.) using the "Split Column" feature. Here’s how you can do it step-by-step:
Splitting a Column Based on Delimiters in Power Query
1. Open Power Query Editor:
- Load your dataset into Excel.
- Go to the `Data` tab and click on `Get & Transform Data` > `From Table/Range` to open the Power Query Editor.
2. Select the Column to Split:
- In the Power Query Editor, select the column that contains the delimited values that you want to split into multiple columns.
3. Split Column by Delimiter:
- Right-click on the column header and choose `Split Column` > `By Delimiter`.
![Split Column by Delimiter](https://i.imgur.com/sd59qBQ.png)
4. Specify Delimiter Settings:
- In the "Split Column by Delimiter" dialog box, specify the delimiter type (such as Comma, Semicolon, Tab, Space, or Custom) that separates the values in your column.
- Adjust settings such as:
- Delimiter: Choose the specific character or characters that separate the values.
- Split Option: Choose whether to split into rows (`Each occurrence of the delimiter`) or columns (`At each occurrence of the delimiter`).
- Split Into: Choose how many columns to split into (e.g., split into two columns, split into multiple columns based on specific number of delimiters, etc.).
![Specify Delimiter Settings](https://i.imgur.com/q9D49j1.png)
5. Review and Apply Changes:
- Review the preview in the dialog box to ensure the data is splitting correctly based on your settings.
- Click `OK` to apply the split operation.
6. Load Transformed Data:
- Power Query will split the selected column into multiple columns based on the specified delimiter.
- Click `Close & Load` to load the transformed data into Excel.
Example: Splitting a Column Based on Comma Delimiter
Suppose you have a dataset `EmployeeData` with a column `Skills` that contains values separated by commas (e.g., "Java, SQL, Python"). To split the `Skills` column into separate columns:
1. Open Power Query Editor:
- Load `EmployeeData` into Power Query.
2. Split Column:
- Select the `Skills` column header.
3. Split by Delimiter:
- Right-click on the `Skills` column header, choose `Split Column` > `By Delimiter`.
4. Specify Settings:
- In the "Split Column by Delimiter" dialog:
- Choose `Comma` as the delimiter.
- Select `Split into columns` and adjust any other settings as needed.
5. Apply Changes:
- Click `OK` to split the `Skills` column into multiple columns based on commas.
6. Load Data:
- Click `Close & Load` to load the transformed data into Excel with the split columns.
Advanced Tips
- Handling Custom Delimiters: If your data uses a custom delimiter (e.g., a specific character or string), choose `Custom` in the delimiter options and enter the custom delimiter.
- Handling Uneven Splits: If some rows have more delimiter occurrences than others, Power Query can adjust by adding null or empty values in additional columns.
By following these steps, you can effectively split a single column into multiple columns based on delimiters in Power Query, enabling you to organize and analyze data more efficiently within Excel.