Sub topic 2
PROPER: Standardizing Capitalization
Assume you can enter and copy Excel formulas, use relative references such as A2, and distinguish text from numbers. This chapter focuses on capitalization, basic cleanup, and diagnosing hidden characters.
PROPER: Standardizing Capitalization
PROPER changes text to title case. It capitalizes the first letter of each word and changes other letters to lowercase.
=PROPER(A2)For example, northwind SALES becomes Northwind Sales. This can make names and labels easier to read and compare. However, PROPER does not remove extra spaces or hidden characters.
Combining the Three Functions in One Formula
Use CLEAN to remove non-printing control characters, TRIM to remove extra ordinary spaces, and PROPER to standardize capitalization. A sensible order is:
=PROPER(TRIM(CLEAN(A2)))The formula processes the original value from the inside out:
flowchart TD
A["Original text in A2"] --> B["CLEAN: remove control characters"]
B --> C["TRIM: remove extra spaces"]
C --> D["PROPER: standardize capitalization"]
D --> E["Cleaned text"]caption: Text-cleaning formula order alt: A flowchart showing CLEAN followed by TRIM and then PROPER.
Enter the formula in a helper column, such as B2, then copy it down. A helper column keeps the original data available for review. After checking names and abbreviations, you can replace the formulas with their results by copying the helper column and choosing Paste Special > Values.
Finding Hidden Characters with LEN and UNICODE
If two values look identical but do not match, compare their lengths:
=LEN(A2)-LEN(TRIM(A2))A result greater than zero shows that TRIM would remove characters, usually extra spaces.
To inspect the last character, use:
=UNICODE(RIGHT(A2,1))A result of 160 identifies a non-breaking space. TRIM does not remove this character. Replace it with an ordinary space before cleaning:
=PROPER(TRIM(CLEAN(SUBSTITUTE(A2,CHAR(160)," "))))UNICODE is useful when the visible text gives no clue why a lookup or comparison fails.
Exercise
Which formula cleans control characters, extra spaces, and capitalization in A2, in that order?
Show answer
=PROPER(TRIM(CLEAN(A2)))