LearnExcelText Cleaning Functions
CLEANING

Text Cleaning Functions

Clean and reshape messy text with TRIM, LEFT, RIGHT, MID and LEN.

After this lessonStandardize imported codes and descriptions.

How it works

TRIM removes leading and trailing spaces and collapses repeated spaces. LEFT, RIGHT and MID extract parts of a text value, while LEN measures its character count.

Text cleanup is often necessary before lookups or duplicate checks because invisible spaces can make two apparently identical keys different.

REAL WORK

Clean copied material descriptions or extract plant, year or sequence codes from structured identifiers.

SYNTAX

The pattern

=TRIM(text)
=LEFT(text, n)
=RIGHT(text, n)

Example

=TRIM(F2)
TRY IT

Test the formula

The sample sheet is local to this page. Change the formula and see the result immediately.

fx
Result
QUICK CHECK

Which function removes repeated spaces?

Progress is stored only in this browser. No account required.