Skip to content

Split a column with Text to Columns

Clean up messy data9 min

Builds on Type numbers, text and dates.

A payroll assistant in Chicago gets the new hires from HR as one column, last name first: Okafor, Ben. The payroll system wants the last names and the first names in columns of their own.

How it works

Select the column, one column with as many rows as you need, and choose Data > Text to Columns. A wizard asks three things:

  1. The data type. Delimited splits wherever a character appears, such as a comma, a semicolon, a tab or a space. Fixed width splits at character positions, for files where each field takes the same number of characters.
  2. The delimiters, or the break lines for fixed width. When two delimiters stand side by side, such as a comma and a space, tick Treat consecutive delimiters as one, or Excel makes an empty column between them.
  3. A format for each new column, and the Destination. General turns whatever looks like a number or a date into one. Text keeps a column exactly as written, Date reads the parts in the order you pick, such as DMY, and Do not import column (skip) leaves a piece out.

The pieces fill the selected column and the columns to its right, replacing whatever is there. Insert empty columns first, or set the Destination to an empty part of the sheet.

Example

The new hires in A2:A5, split with two different settings:

The comma ends the last name, and the space after it starts the first name. Tick both, with Treat consecutive delimiters as one, and each piece comes out clean.

Common mistakes

  • Comma alone for names like Okafor, Ben. Every first name starts with a space, so lookups and counts miss it. Tick Space as well, with Treat consecutive delimiters as one.
  • General for codes with leading zeros. The ZIP code 02108 becomes 2108. Choose Text for that column in step 3.
  • General for dates written day first. In Excel set to US dates, 05/03/2027 comes in as May 3, and 15/03/2027 stays text. Choose Date with DMY.

In short

  • Data > Text to Columns splits one column at delimiters or at fixed positions.
  • For a comma followed by a space, tick both and Treat consecutive delimiters as one.
  • In step 3, choose Text for codes with zeros and Date with the file's order for dates.
  • The pieces replace whatever sits to the right, so make room first.

Practice

4 exercises · free, no account needed

Start practicing
  1. Not started

    1. Split the scanner export

    Dialog · easy

  2. Not started

    2. Keep the zeros in the ZIP codes

    Dialog · medium

  3. Not started

    3. Split a fixed-width bank file

    Dialog · hard

  4. Not started

    4. The column beside the split

    Quiz · easy