Split a column of text (Power Query)
Note: Power Query is known as Get & Transform in Excel 2016. Information provided here applies to both. To learn more, see Get & Transform in Excel 2016.
Note: For a quick video on how to display Query Editor, see the end of this article.
Using the Query Editor, a column of text can be split into multiple columns in two ways: by delimiter or by a number of characters.
I want to
Split a column by delimiter
Split Column > By Delimiter parses a text value based on a common character into two or more columns. For example, a Name column as LastName, FirstName can be split into two columns based on the comma (,) character.
Using the Query Editor ribbon
-
Select the column you want to split.
-
In the Query Editor ribbon, select Split Column > By Delimiter.
Using the Query Editor context menu
-
Right-click the column header you want to split.
-
In the column context menu, select Split Column > By Delimiter.
To split a column by delimiter
-
In the Split a column by delimiter dialog box:
-
In the Select or enter a delimiter drop-down, select Colon, Comma, Equals Sign, Semicolon, Space, Tab, or Custom. Select Custom to specify any character delimiter.
-
Select a Split option.
-
Expand Show advanced options, and enter the Number of columns to split into.
-
-
Select OK.
-
Rename the new columns to more meaningful names. For more information about how to rename a column, see Rename a column.
-
In the Split a column by delimiter dialog box:
-
In the Select or enter a delimiter drop-down, select Colon, Comma, Equals Sign, Semicolon, Space, Tab, or Custom. Select Custom to specify any character delimiter.
-
Select a Split option.
-
Expand Show advanced options, and enter the Number of columns to split into.
-
-
Select OK.
-
Rename the new columns to more meaningful names. For more information about how to rename a column, see Rename a column.
Split a column by position
Split Column > By Number of Characters parses a text value based on a character position within a text value.
Using the Query Editor ribbon menu
-
Select the column you want to split.
-
In the Query Editor ribbon, click Split Column > By Number of Characters.
Using the Query Editor context menu
-
Right-click the column header you want to split.
-
In the column context menu, select Split Column > By Number of Characters
To split a column by position
-
In the Split a column by position dialog box:
-
In the Number of character textbox, enter the number of characters used to split the text column.
-
Select a Split option.
-
Expand Show advanced options, and enter the Number of columns to split into.
-
-
Click OK.
-
Rename the new columns to more meaningful names. For more information about how to rename a column, see Rename a column.
-
In the Split a column by position dialog box:
-
In the Number of character textbox, enter the number of characters used to split the text column.
-
Select a Split option.
-
Expand Show advanced options, and enter the Number of columns to split into.
-
-
Click OK.
-
Rename the new columns to more meaningful names. For more information about how to rename a column, see Rename a column.
Note: The Query Editor only appears when you load, edit, or create a new query using Power Query. The following video shows the Query Editor window appearing after editing a query from an Excel workbook. To view the Query Editor without loading or editing an existing workbook query, from the Get External Data section in the Power Query ribbon tab, select From Other Sources > Blank Query. The following video shows one way to display the Query Editor.
No comments:
Post a Comment