Core Excel data cleaning formulas
Real-world CSV exports rarely arrive ready for VLOOKUP or SUMIFS. Keep these six functions on hand to standardize raw columns in seconds:
=TRIM(" LM-309 ") → "LM-309"Removes leading, trailing, and repeated internal spaces
=SUBSTITUTE("LM-309#", "#", "") → "LM-309"Replaces specific unwanted characters or symbols
=TRIM(CLEAN(A4))Strips non-printing line breaks and control characters from CSV exports
=VALUE(SUBSTITUTE(A4, "$", ""))Converts numbers stored as text back into real numeric values
=UPPER(TRIM(A4))Standardizes inconsistent capitalization before grouping or PivotTables
=TEXTBEFORE(A4, "-") → "LM"Extracts codes, domains, or fields from delimiter-separated strings
4 mistakes that leave dirty data behind
Running TRIM without SUBSTITUTE
TRIM only removes extra spaces — stray symbols like #, $, or non-breaking spaces (CHAR(160)) stay behind and break exact lookups.
Running SUBSTITUTE without TRIM
Replacing "#" leaves hidden leading or trailing spaces intact. Two cells that look identical on screen still fail VLOOKUP with #N/A.
Stripping all spaces with SUBSTITUTE(A4," ","")
Replacing every space removes spaces between words (turning "New York" into "NewYork"). Use TRIM for spaces and SUBSTITUTE for stray symbols.
Forgetting to paste values before deleting raw data
In desktop Excel, keep your cleaning formula column or use Copy → Paste Values once verified so formulas do not break if raw columns are removed.
FAQ
Does the order of TRIM and SUBSTITUTE matter?
For removing a stray symbol like "#" plus outer spaces, both =TRIM(SUBSTITUTE(A4,"#","")) and =SUBSTITUTE(TRIM(A4),"#","") return the same clean SKU. Wrapping TRIM on the outside is a good default because it also catches any spaces uncovered when a symbol is removed.
Why does VLOOKUP still return #N/A after I use TRIM?
Two common reasons: either the cell contains a web non-breaking space (CHAR(160)) that TRIM does not remove — fix with =TRIM(SUBSTITUTE(A4,CHAR(160)," ")) — or one table stores IDs as text while the other stores them as numbers.
What is the difference between SUBSTITUTE and REPLACE in Excel?
SUBSTITUTE replaces matching text wherever it appears (for example every "#"). REPLACE swaps characters by numeric position (for example 3 characters starting at position 1).
Can I clean messy spreadsheet data without Power Query or VBA?
Yes. Most day-to-day CSV cleanup tasks — stray symbols, trailing spaces, inconsistent case, text-formatted numbers, and split fields — take a single formula combining TRIM, SUBSTITUTE, CLEAN, VALUE, and TEXTSPLIT.