TRIM
How to remove extra spaces and change text case in Excel (TRIM, UPPER, LOWER, PROPER)
TRIM removes extra spaces; UPPER, LOWER and PROPER convert text to uppercase, lowercase or title case.
Syntax
=TRIM(text)
- text — The text or cell to clean up.
Example
Formula:
=PROPER(TRIM(A2))→ result: Tashkent City
Why it matters
Invisible spaces break VLOOKUP and COUNTIF: “Tashkent ” and “Tashkent” are treated as different values. Always run imported data through TRIM.
UPPER, LOWER, PROPER
=UPPER(A2) → BUKHARA, =LOWER(A2) → bukhara, =PROPER(A2) → Bukhara.
Put it into practice
Frequently asked questions
Text copied from a website often contains a non-breaking space (CHAR(160)): =TRIM(SUBSTITUTE(A2,CHAR(160)," ")).