Sub topic 10
Where PROPER gets names and abbreviations wrong
This chapter assumes you can enter and copy formulas, use relative references such as A2, and tell text from numbers in a cell. It also assumes you have already used PROPER, TRIM, and CLEAN in a helper column. Here you will learn the rule PROPER follows, which kinds of text break that rule, and how to fix or avoid the damage.
The rule behind PROPER
PROPER does not know what a name, a word, or an abbreviation is. It applies one mechanical rule to every character:
- Capitalize a letter if it is the first character in the cell or follows any character that is not a letter.
- Lowercase every other letter.
Spaces, hyphens, periods, apostrophes, and digits all count as "not a letter". Everything in this chapter follows from that rule. The function gets hyphenated names right because a hyphen is a non-letter. It gets it's wrong for the same reason, because the apostrophe is a non-letter too.
What goes wrong
The table shows what PROPER returns for typical inputs and what you probably wanted.
| Input | PROPER result | What you wanted | Cause |
|---|---|---|---|
| `mcdonald` | `Mcdonald` | `McDonald` | Only the first letter of a word is capitalized |
| `it's` | `It'S` | `It's` | A letter after an apostrophe is capitalized |
| `o'brien` | `O'Brien` | `O'Brien` | Correct, by the same rule that breaks `it's` |
| `NASA` | `Nasa` | `NASA` | All other letters are lowercased |
| `acme llc` | `Acme Llc` | `Acme LLC` | Abbreviations are lowercased |
| `van der berg` | `Van Der Berg` | `van der Berg` | Particles are capitalized |
| `3rd floor` | `3Rd Floor` | `3rd Floor` | A letter after a digit is capitalized |
| `ab-123x` | `Ab-123X` | `AB-123X` | Codes are treated as words |
| `iPhone` | `Iphone` | `iPhone` | Deliberate mixed case is flattened |
Two points are easy to miss:
PROPERalso destroys correct data. A cell that already holdsMcDonaldcomes out asMcdonald. Running it over a column that was partly clean makes that column worse.- The result looks plausible.
NasaandAcme Llcare not obviously corrupt, so the errors survive into reports unless you look for them.
Decision flow
Not every cell should go through PROPER. The diagram shows one way to decide.
Protect cells that are already correct
The simplest defense is to apply PROPER only when the text is entirely upper case or entirely lower case. Mixed-case text probably had a person's attention at some point.
=IF(OR(EXACT(A2,UPPER(A2)),EXACT(A2,LOWER(A2))),PROPER(A2),A2)EXACT compares two strings and is case-sensitive, unlike the = operator. If A2 equals its own upper-case or lower-case version, it has no useful capitalization, so PROPER is safe to apply. Otherwise the formula returns the original text.
This rule has a gap. A name typed in all capitals, such as MCDONALD, still becomes Mcdonald. Mixed-case protection cannot help when the capitalization was already lost.
Find the cells PROPER would damage
Before you replace a column, flag the rows where PROPER would change text that was already mixed case. Suppose A2 holds the original and B2 holds =PROPER(A2). This formula in C2 returns TRUE for those rows:
=AND(NOT(EXACT(A2,UPPER(A2))),NOT(EXACT(A2,LOWER(A2))),NOT(EXACT(A2,B2)))Filter column C for TRUE and inspect those rows. Typical hits are McDonald, iPhone, DeAngelo, and van der Berg. These are the entries a person typed carefully and PROPER would undo.
Fix the apostrophe-s problem
The spine formula for possessives and contractions is:
=SUBSTITUTE(PROPER(A2),"'S","'s")It fixes It'S but also changes O'Sullivan to O'sullivan, because SUBSTITUTE matches the characters 'S wherever they appear. A safer version targets only an 'S that ends a word. It appends a space to the text so the last word has a boundary, replaces 'S with 's , then trims the space off again:
=TRIM(SUBSTITUTE(PROPER(A2)&" ","'S ","'s "))O'Sullivan contains 'Su, not 'S , so it is left alone. Joe'S Pizza becomes Joe's Pizza.
Restore abbreviations
For a short list of known abbreviations, wrap the result in SUBSTITUTE calls that match whole words only. Padding the text with spaces is what makes this work. Without it, Llc could match inside a longer word.
=TRIM(SUBSTITUTE(SUBSTITUTE(" "&PROPER(A2)&" "," Llc "," LLC ")," Usa "," USA "))Each SUBSTITUTE replaces one word. The leading and trailing spaces give every word a space on both sides, so the first and last words match too. TRIM at the end removes the padding.
Edge cases to expect:
- A word followed by punctuation does not match.
Acme Llc.andAcme Llc,containLlc.andLlc,, so your pattern" Llc "misses them. Add a secondSUBSTITUTEfor each punctuation form you see in your data. - Two identical abbreviations in a row, such as
Llc Llc, can leave the second one unchanged.SUBSTITUTEdoes not look for overlapping matches, and the space between the two words belongs to both. - Long chains get hard to read and maintain. If you need more than four or five replacements, move to a table of exceptions (see the section on larger exception lists).
Restore Mc names
The Mc prefix needs a conditional. Let B2 hold the PROPER result. Capitalize the third character when the name starts with Mc:
=IF(LEFT(B2,2)="Mc",REPLACE(B2,3,1,UPPER(MID(B2,3,1))),B2)REPLACE(text, start, length, new) swaps one character for another by position. For Mcdonald it replaces the d at position 3 with D, giving McDonald. The formula only looks at the start of the whole cell. A full name such as John Mcdonald is not changed, because LEFT(B2,2) is Jo. To handle a surname at the end of a cell, you need to split first and last names into separate columns.
Other patterns, such as Mac, De, La, and Van, are unreliable to automate. Mackenzie should be MacKenzie for some people and Mackenzie for others, and Macy should stay Macy. No formula can know which you mean.
Digits and codes
The letter after a digit is capitalized, so ordinals and part numbers break. You can fix common ordinals with a few SUBSTITUTE calls:
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(PROPER(A2),"1St","1st"),"2Nd","2nd"),"3Rd","3rd")This has the same weakness as the abbreviation fix, because 1St also appears inside codes such as 11St. It is also incomplete: 4Th through 9Th, 10Th, and so on need more calls. If the column mixes addresses with product codes, do not run PROPER on the code column at all. Apply it only to the columns that contain names or free text.
Larger exception lists
When the exceptions outgrow a single formula, keep them in a small table on another sheet. Put the wrong form in one column and the right form in the next, for example Llc and LLC. Then process each word with a lookup. This approach needs the text split into words first, which in current Excel versions is done with TEXTSPLIT and recombined with TEXTJOIN. It is the right tool when the same exceptions recur across many files, but it takes more setup than the formulas in this chapter. For one-off cleanups, chained SUBSTITUTE and a manual review are usually quicker.
A practical order of work
- Clean spaces and control characters first, as in the earlier chapters.
- Apply
PROPERonly where the text is all upper or all lower case. - Run the flag formula against the original column and review the mixed-case rows.
- Apply the
SUBSTITUTEandREPLACEfixes for the exceptions that actually appear in your data. - Sort or filter the result and scan it. Look at short all-capital words, names starting with
Mc, and anything with digits. - Only after that, convert the formulas to values.
Exercise
A cell A2 holds DEANNA O'SULLIVAN and a cell A3 holds Joe'S Cafe. Write a formula for A3 that returns Joe's Cafe without touching an apostrophe followed by a capital letter inside a name. Then say what =PROPER(A2) returns and whether it needs a fix.
Show answer
Use =TRIM(SUBSTITUTE(PROPER(A3)&" ","'S ","'s ")). PROPER(A3) gives Joe'S Cafe, and the substitution matches 'S followed by a space, which here only the possessive provides. =PROPER(A2) returns Deanna O'Sullivan, which is correct, so it needs no fix. The apostrophe rule capitalizes the S after it, which is right for this name.
Exercise
Column A holds company names such as acme llc and BRIGHT FUTURE LLC. Write one formula that returns Acme LLC for the first and Bright Future LLC for the second.
Show answer
=TRIM(SUBSTITUTE(" "&PROPER(A2)&" "," Llc "," LLC ")). PROPER turns both entries into Acme Llc and Bright Future Llc. Padding with spaces makes Llc a whole word, SUBSTITUTE swaps it for LLC, and TRIM removes the padding. Entries ending in Llc. or Llc, need an extra SUBSTITUTE for that form.
Exercise
You have a column of names, some typed in all capitals and some typed with careful capitalization such as McDonald and DeAngelo. Which formula should you use to avoid damaging the careful ones, and what cannot it fix?
Show answer
Use =IF(OR(EXACT(A2,UPPER(A2)),EXACT(A2,LOWER(A2))),PROPER(A2),A2). It applies PROPER only to text that is entirely upper or lower case and returns mixed-case text unchanged. It cannot fix names that were typed in all capitals, such as MCDONALD, because the correct capitalization is already lost. Those still become Mcdonald and need an Mc fix or a manual edit.