Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

5 Excel Functions for Cleaning Text and Splitting Data

Use TRIM, CLEAN, IFERROR, TEXTSPLIT and TEXTJOIN with corrected examples, version checks and safeguards against hiding or creating data errors.

Table of Contents

Use TRIM and CLEAN for common unwanted characters, TEXTSPLIT to separate consistent fields, and TEXTJOIN to combine them again. IFERROR can make expected errors easier to read, but it does not repair the underlying data. Work in helper columns and preserve the imported values until you have checked the results.

1. TRIM: remove extra ordinary spaces

=TRIM(A1)

TRIM removes leading and trailing ordinary spaces and reduces repeated spaces between words to one. Fill the formula down a helper column, then compare a few long and short entries.

5 Functions to Instantly Clean Up Messy Excel Spreadsheets Picture 1

TRIM does not remove every Unicode whitespace character. For a known nonbreaking-space problem from a website, this is a common targeted cleanup:

=TRIM(SUBSTITUTE(A1,CHAR(160)," "))

Do not remove meaningful internal spacing from codes or formatted text without checking the consequences. See the TRIM guide for the basic behavior.

2. IFERROR: handle expected errors carefully

An exact VLOOKUP with no matching key normally returns #N/A, not #NAME?. The latter often signals an unrecognized name or function.

=IFERROR(VLOOKUP(A1,Table1,2,FALSE),"Check lookup")

5 Functions to Instantly Clean Up Messy Excel Spreadsheets Picture 2

5 Functions to Instantly Clean Up Messy Excel Spreadsheets Picture 3

This catches any formula error, including structural mistakes. If only a missing match is expected, consider IFNA instead so other errors remain visible. Test the lookup without an error wrapper before deciding which failures to hide.

3. CLEAN: remove a limited set of nonprinting characters

=TRIM(CLEAN(A1))

CLEAN targets the first 32 nonprinting ASCII characters. It does not remove every invisible Unicode character. It also removes line breaks, so use it only when those breaks are unwanted.

5 Functions to Instantly Clean Up Messy Excel Spreadsheets Picture 4

5 Functions to Instantly Clean Up Messy Excel Spreadsheets Picture 5

If a character separates words or fields, replace it with a space or delimiter before cleanup so the words do not merge. Inspect the actual pattern instead of repeatedly nesting cleanup functions and hoping for the best.

4. TEXTSPLIT: separate fields using delimiters

TEXTSPLIT is available in supporting versions such as Microsoft 365 and Excel 2024, not standard Excel 2021. If A1 contains Ada,Uche,ada.uche@example.com, use:

=TEXTSPLIT(A1,",")

5 Functions to Instantly Clean Up Messy Excel Spreadsheets Picture 6

For a mix of commas and semicolons in A2:

=TEXTSPLIT(A2,{",",";"})

5 Functions to Instantly Clean Up Messy Excel Spreadsheets Picture 7

To use semicolons as row separators and commas as column separators, put Apple,Banana;Cherry,Dates in A2 and use:

=TEXTSPLIT(A2,",",";")

This produces two rows and two columns. The third argument sets the row delimiter; the fourth controls empty results, and the fifth controls case matching. Changing either of those to TRUE does not mean “split into rows.”

5 Functions to Instantly Clean Up Messy Excel Spreadsheets Picture 8

Leave the output area empty to avoid a spill error. These simple formulas assume the delimiter is not also part of a quoted field; use an appropriate import tool for complex CSV data. Formula and array separators can differ by regional settings.

5. TEXTJOIN: combine values with a separator

=TEXTJOIN(" ",TRUE,A1:C1)

This joins name parts with spaces and ignores empty cells. It does not trim a cell that contains spaces or normalize the text itself, so clean the source fields first when necessary.

5 Functions to Instantly Clean Up Messy Excel Spreadsheets Picture 9

Finish with a check, not just a paste

Compare record counts, missing values and several known records before replacing any source column. Copy and paste values only after validating the helper results, and keep a recoverable original. If numbers remain stored as text, see the VALUE function guide for that separate conversion.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.