0Pricing
Excel Formulas Academy · Lesson

Splitting and Cleaning Messy Data

Use SPLIT and CLEAN to break apart and tidy imported text.

Splitting and Cleaning Messy Data is a free Excel Formulas Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Excel Formulas Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Breaking One Cell Into Many

Imported data is rarely tidy. A single cell might hold John,Smith,Sales when you really want three separate columns.

The SPLIT function in Google Sheets breaks a string apart at a delimiter and spills the pieces across adjacent cells.

In this final lesson you will pair SPLIT and CLEAN with the regex skills you just learned to fully tidy messy text.

The SPLIT Syntax

SPLIT(text, delimiter) divides text wherever it finds the delimiter and outputs each piece into its own cell to the right.

The formula below splits A2 on commas. John,Smith,Sales spills into three cells: John, Smith, and Sales.

=SPLIT(A2, ",")

Splitting on Multiple Delimiters

By default each character in the delimiter string is treated as its own separator. So SPLIT(A2, ",;") splits on commas and semicolons.

The formula below splits on either a comma or a space, handy when separators are inconsistent across rows.

=SPLIT(A2, ", ")

Keeping Empty Pieces

SPLIT has optional arguments. The third controls whether each delimiter character splits separately, and the fourth controls whether empty results are removed.

By default empty pieces are dropped, which can shift your columns. The formula below keeps empties by passing FALSE as the last argument, preserving column alignment for A,,C.

=SPLIT(A2, ",", TRUE, FALSE)

Cleaning Invisible Characters With CLEAN

Text pasted from PDFs or web pages often carries invisible control characters that break formulas and lookups.

The CLEAN function removes most non-printable characters from a string. The formula below returns A2 with those gremlins stripped out, so a value that looked equal but never matched finally behaves.

=CLEAN(A2)

CLEAN Plus TRIM Plus SPLIT

CLEAN handles control characters but not extra spaces. Pair it with TRIM, which removes leading, trailing, and repeated spaces, then split.

The formula below cleans control characters, trims spaces, and splits the result on commas in one expression. Read it inside out.

=SPLIT(TRIM(CLEAN(A2)), ",")

Worked Example: Tidy an Imported Name List

Column A holds messy entries like Smith , John with stray spaces. You want clean first and last names in separate cells.

The formula below trims and splits on the comma. To also clean each piece, you can wrap individual results in TRIM after splitting, but cleaning first usually does the job.

=ARRAYFORMULA(TRIM(SPLIT(A2, ",")))

When SPLIT Is Not Enough, Use REGEX

SPLIT needs a literal delimiter. When separators vary, normalize them with REGEXREPLACE first, then split on the standard one.

The formula below replaces any run of spaces, commas, or semicolons with a single pipe, then splits on the pipe. This handles wildly inconsistent input cleanly.

=SPLIT(REGEXREPLACE(A2, "[ ,;]+", "|"), "|")

Worked Example: Extract Then Split

Sometimes you want only part of a cell, then split that. From Tags: red, blue, green you want just the colors as separate cells.

The formula below first extracts everything after the colon, then splits on the comma. Combining the regex and split tools is where the real power shows.

=SPLIT(REGEXEXTRACT(A2, ": (.+)$"), ", ")

A Repeatable Cleaning Recipe

For most messy imports, this order works well:

  • CLEAN to drop control characters
  • TRIM to fix spacing
  • REGEXREPLACE to standardize delimiters or strip junk
  • SPLIT to break into columns

The formula below applies all four steps in sequence to a single cell.

=SPLIT(REGEXREPLACE(TRIM(CLEAN(A2)), "[;, ]+", "|"), "|")

Splitting Into Rows Instead of Columns

SPLIT spreads pieces across columns by default. Sometimes you want a vertical list instead, one value per row, ready for filtering or counting.

Wrap SPLIT in TRANSPOSE to flip the spilled row into a column. The formula below splits A2 on commas and stacks the results vertically, which is perfect for turning a comma list into a clean lookup column.

=TRANSPOSE(SPLIT(A2, ","))

Quick Check

Check your understanding of splitting and cleaning.

Recap: Split, Clean, and Tidy

You finished the course by combining splitting and cleaning tools in Google Sheets:

  • SPLIT(text, delimiter) breaks a cell into spilled columns
  • Extra arguments control multi-char delimiters and empty pieces
  • CLEAN strips invisible control characters; TRIM fixes spaces
  • Use REGEXREPLACE to standardize messy delimiters before splitting
  • Chain CLEAN, TRIM, REGEXREPLACE, and SPLIT for a repeatable cleanup

You now have a complete regex toolkit: match, extract, replace, split, and clean.

Frequently asked questions

Is the “Splitting and Cleaning Messy Data” lesson free?

Yes — the full text of “Splitting and Cleaning Messy Data” is free to read here on the web, and the Excel Formulas Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Excel Formulas Academy course, upgrade to CoddyKit PRO.

What will I learn in “Splitting and Cleaning Messy Data”?

Use SPLIT and CLEAN to break apart and tidy imported text. You practise Excel Formulas Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Excel Formulas Academy?

No prior experience is required. Excel Formulas Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Splitting and Cleaning Messy Data” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Excel Formulas Academy lesson?

Yes. Every Excel Formulas Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Testing Patterns With REGEXMATCH
  2. Pulling Out Patterns With REGEXEXTRACT
  3. Replacing Patterns With REGEXREPLACE
  4. Splitting and Cleaning Messy Data
← Back to Excel Formulas Academy