AnalystPracticeGuides
DashboardSign up

UPPER, LOWER, PROPER and TRIM: cleaning text in Excel

UPPER, LOWER and PROPER change capitalisation. TRIM removes extra spaces. Imported names and codes usually need both before lookups and counts work.

Watch it solved. Task 10: clean messy text with TRIM and PROPER, from 7:25, in our video “Data Analyst Interview Questions and Answers: 10 SQL + Excel Tasks, Solved”. Pressing play loads the video from YouTube (privacy). Open on YouTube

What does each function do?

For " aNA petroviĆ " in A2:

FormulaResult
=UPPER(TRIM(A2))ANA PETROVIĆ
=LOWER(TRIM(A2))ana petrović
=PROPER(TRIM(A2))Ana Petrović

TRIM removes spaces at the start and end and turns double spaces inside the text into single ones.

Why does my VLOOKUP fail on values that look the same?

Often because one of them has a trailing space. Clean both sides with TRIM, or look for it with =LEN(A2).

Why doesn't TRIM remove every space?

Data from websites often contains non-breaking spaces (character 160), which TRIM ignores. Replace them first:

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

Where does PROPER go wrong?

It capitalises after every non-letter, so "o'neill" becomes "O'Neill" (good) but "mcdonald" becomes "Mcdonald" and "ABC ltd" becomes "Abc Ltd". Check names after using it.

Try it yourself. Practise this in a real spreadsheet in your browser, with instant feedback.
Practise UPPER, LOWER, PROPER Practise cleaning data

Updated November 2026.

← All free guides