Sub topic 5
PROPER: standardizing capitalization
This chapter assumes you can enter and copy formulas, use relative references such as A2, and tell text from numbers in a cell. You will work in a helper column, as in earlier chapters.
Why capitalization matters
Imported names and labels often mix cases: "JOHN SMITH", "john smith", "jOHN sMITH". Excel's lookup functions such as VLOOKUP and MATCH ignore case, so mixed case rarely breaks them. The problems are visual and practical. Sorted lists look uneven, reports look careless, and exports to other systems may treat "NY" and "Ny" as different values.
PROPER fixes this by applying one rule to every cell.
What PROPER does
PROPER capitalizes the first letter of each word, and any letter that follows a non-letter character. It lowercases every other letter.
=PROPER(A2)| Input in A2 | Result |
|---|---|
| john SMITH | John Smith |
| MARY-ANN lee | Mary-Ann Lee |
| 3rd floor | 3Rd Floor |
| it's here | It'S Here |
The last two rows show the rule at work. A letter after a digit or an apostrophe counts as the start of a new word, so "3rd" becomes "3Rd" and "it's" becomes "It'S".
PROPER does not remove spaces or hidden characters. It leaves numbers and punctuation unchanged. If the cell holds a number, PROPER returns it as text.
Using PROPER in a helper column
Put the formula in a new column next to the data and copy it down. Keep the original column until you have checked the results.
- In B2, enter
=PROPER(A2). - Double-click the fill handle to copy the formula down.
- Scan the results for the cases described below.
Because PROPER does not trim spaces, " john smith " becomes " John Smith " with the extra spaces intact. In practice you will nest it with the other two functions, which a later chapter covers:
=PROPER(TRIM(CLEAN(A2)))Where PROPER gets it wrong
PROPER has no dictionary. It cannot tell a name from an abbreviation, so check the output for these patterns.
- Apostrophes: "it's" becomes "It'S". Names such as "O'Sullivan" come out correctly, but possessives and contractions do not.
- Prefixes in names: "McDonald" becomes "Mcdonald", and "van der Berg" becomes "Van Der Berg".
- Abbreviations: "USA" becomes "Usa", and "PO Box" becomes "Po Box".
- Digits inside words: "3rd" becomes "3Rd".
A common fix for the apostrophe case is to wrap PROPER in SUBSTITUTE:
=SUBSTITUTE(PROPER(A2),"'S","'s")Correct the remaining exceptions by hand, or add one SUBSTITUTE per known pattern. For a long list of exceptions, consider Flash Fill or Power Query, covered in a later chapter.
Common errors
- Expecting PROPER to fix spacing. It only changes letter case. Use TRIM for spaces.
- Overwriting the source. Typing PROPER over the original column loses your data. Use a helper column.
- Trusting the output blindly. Always scan for acronyms, prefixed surnames and apostrophes.
Exercise
Cell A2 contains "the NASA team's 2nd report". What does =PROPER(A2) return, and which parts are wrong?
Show answer
It returns "The Nasa Team'S 2Nd Report". "Nasa" should be "NASA", "Team'S" should be "Team's", and "2Nd" should be "2nd". You would fix these with SUBSTITUTE or by hand.
Exercise
Why should you enter PROPER in a helper column instead of in the original column?
Show answer
A formula cannot sit in the same cell as the data it reads without losing that data. A helper column keeps the original values so you can compare results and recover from mistakes.