Extra spaces are invisible, but they break your formulas. “Smith ” with a space at the end is not equal to “Smith”, so a lookup fails and a count is wrong. TRIM removes the spaces at the start, at the end, and the double spaces in the middle.
The following exercise shows you how to clean a list of names with TRIM and check the result with LEN.
What you will practice in this exercise
You work on a customer list typed with stray spaces. You answer 5 questions, one formula per question:
- Clean a last name (TRIM)
- Clean a first name (TRIM)
- Clean and combine last name + first name (TRIM + &)
- Count the characters before cleaning (LEN)
- Count the characters after cleaning (LEN + TRIM)
Practice with exercises
CLEAN — Remove extra spaces
Strip stray spaces from a customer database with TRIM.
Related articles
All the exercises in this series are based on real cases found on Excel forums. Each one answers a question that Excel users really ask.