Day 18: Flash Fill and Text to Columns – Cleaning and Restructuring Data

Day 18: Flash Fill and Text to Columns – Cleaning and Restructuring Data

Welcome to Day 18 of our Excel learning journey! Yesterday, we learned how to use data validation to create dropdown lists and ensure accurate data entry. Today, we’ll focus on two powerful tools: Flash Fill and Text to Columns. These features are essential for cleaning and restructuring messy data without writing complex formulas.

If you’ve ever needed to split full names, combine data, or reformat text, Flash Fill and Text to Columns can save you hours of manual work. Let’s dive in!


What is Flash Fill?

Flash Fill is an intelligent tool that automatically detects patterns in your data and fills the rest of the column based on the example you provide.

Why Use Flash Fill?

  • Split data (e.g., first and last names).
  • Combine data (e.g., full names or email addresses).
  • Reformat text (e.g., phone numbers or dates).

How to Use Flash Fill

1. Splitting Data

Example: Split full names into first and last names.

Full Name First Name Last Name
John Doe
Alice Smith

Steps:

  1. In the First Name column, type John (the first name of the first entry).
  2. Press Enter to move to the next row.
  3. Go to the Data tab and click Flash Fill, or press Ctrl + E.

Result: Excel fills in all first names automatically. Repeat for the Last Name column.


2. Combining Data

Example: Combine first and last names into a single column.

First Name Last Name Full Name
John Doe
Alice Smith

Steps:

  1. In the Full Name column, type John Doe (the combined name).
  2. Press Enter and go to the next row.
  3. Use Flash Fill (Ctrl + E) to fill the rest.

Result: Excel combines all first and last names.


3. Reformatting Data

Example: Reformat phone numbers from 1234567890 to (123) 456-7890.

Raw Phone Formatted Phone
1234567890
9876543210

Steps:

  1. In the Formatted Phone column, type (123) 456-7890 based on the first row.
  2. Use Flash Fill (Ctrl + E) to apply the same format to the rest of the rows.

Result: All phone numbers are reformatted automatically.


What is Text to Columns?

Text to Columns splits data in a single column into multiple columns based on a delimiter (e.g., commas, spaces) or a fixed width.

Why Use Text to Columns?

  • Extract parts of an address or email.
  • Separate CSV data into columns.
  • Split data with consistent spacing.

How to Use Text to Columns

1. Delimited Data

Example: Split email addresses into usernames and domains.

Email Username Domain
john.doe@gmail.com
alice.smith@yahoo.com

Steps:

  1. Select the Email column.
  2. Go to Data > Text to Columns.
  3. In the wizard, select Delimited and click Next.
  4. Check the delimiter box for @ and click Next.
  5. Choose a destination for the split data and click Finish.

Result: Emails are split into usernames and domains.


2. Fixed-Width Data

Example: Split product codes into separate components.

Product Code Category Type ID
ABC12345
XYZ67890

Steps:

  1. Select the Product Code column.
  2. Go to Data > Text to Columns.
  3. In the wizard, select Fixed Width and click Next.
  4. Drag the lines to define where to split the text and click Next.
  5. Choose a destination for the split data and click Finish.

Result: Product codes are split into separate columns.


Practical Example

Use the following dataset to practice:

Full Name Email Phone
John Doe john.doe@gmail.com 1234567890
Alice Smith alice.smith@yahoo.com 9876543210

Exercise 1: Split Full Name

  • Split Full Name into First Name and Last Name using Flash Fill.

Exercise 2: Split Email

  • Split Email into Username and Domain using Text to Columns (delimited by @).

Exercise 3: Reformat Phone Numbers

  • Reformat phone numbers into (123) 456-7890 using Flash Fill.

Pro Tips for Flash Fill and Text to Columns

  • Use Consistent Patterns: Flash Fill works best when data follows a predictable structure.
  • Preview Text to Columns Splits: Use the wizard to preview your results before splitting.
  • Combine Tools: Use Flash Fill to clean data after splitting it with Text to Columns.

Common Mistakes to Avoid

  • Overwriting Data: Use a blank column as the destination to avoid overwriting original data.
  • Inconsistent Patterns: Flash Fill may fail if the input data has irregular patterns.
  • Incorrect Delimiters: Double-check your delimiter selection in Text to Columns.

What’s Next?

Great work cleaning and restructuring data with Flash Fill and Text to Columns! Tomorrow, on Day 19, we’ll explore how to use PivotCharts to create interactive visualizations based on PivotTables.


SEO Keywords:

  • How to use Flash Fill in Excel
  • Splitting data with Text to Columns
  • Reformatting phone numbers in Excel
  • Cleaning data in Excel
  • Excel tutorial for Flash Fill and Text to Columns