TRIM takes a single text argument and returns the cleaned version. Apply it by wrapping any cell reference: =TRIM(A2). The cleaned text is the result and can be used directly inside other formulas without creating a separate helper column. You can nest TRIM inside VLOOKUP to clean the lookup value on the fly: =VLOOKUP(TRIM(A2),Table,2,FALSE). You can use TRIM inside EXACT to compare two cells that should match but might differ due to spaces. The most important thing to understand about TRIM is what it does not remove: line breaks created by Alt+Enter are not spaces and are not removed by TRIM — use
CLEAN for those. Non-breaking spaces from web content (CHAR 160) look like spaces but have a different character code and are not removed by TRIM alone — combine TRIM with
SUBSTITUTE to handle both. To make the cleaning permanent rather than formula-driven, copy the TRIM column and paste as Values Only over the original data. This converts the formula results to static text and removes the dependency on the original unclean column.