Sometimes, your data comes with several pieces of information in one column. Like a column with U.S. states in the format
US-TX. Or a column with companies and the product they sell
But say you want country (
US) separate from state (
TX). Good thing there are easy ways to separate data points into two or more columns.
I’ll show two ways to create multiple new columns out of one old column. We’ll use Google Sheets — but the same tricks should work with LibreOffice Calc, Excel, or any other spreadsheet software.
The first method is the formula
Split columns with SPLIT()
- Create at least two new columns next to the column whose data you want to split. To do so, click on the header (
C, etc.). Then click the little triangle and select “Insert 1 right.” Repeat to create a second empty column.
- In the first empty column, write
B1being the cell you want to split and
-the character you want the cell to split on. (If you see the error
#REF!in your cell, you’ll need to create more columns.)
- To apply the changes to the cells below, drag down the blue square in the bottom right of the selected cell(s). Double-click on the blue square to fill all remaining cells.
Extract content from columns with LEFT()
Sometimes you don’t have clear separator characters, but just want to extract the first or last characters of a cell. To do so, use the formulas
- Insert a new column. (Or two. Or three! As many as you need.)
- In the new column(s), write
=LEFT(B1,2)to extract the first 2 characters of the cell B1.
=RIGHT(B1,8)to extract the last 8 characters of the cell B1.
=MID(B1,4,2)to extract the 2 characters following the 4th character in B1.
- To apply the changes to the cells below, drag down the blue square.