The request

From Helen Parker, Support Specialist
Your goal
In F2:F49, the city from column D with spaces trimmed and each word capitalised. In G2:G49, the state from column E trimmed and in capitals. In H2:H49, TRUE when the cleaned city or state differs from the raw value in any way, case included (use EXACT). In J1, count the changed rows.
- Fill
F2:H49, J1with the right valuesnot done yet - With formulas, not typed numbersnot done yet
- Use
TRIMPROPERUPPEREXACTnot done yet
Your sheet
| A | B | C | D | E | F | G | H | I | J | K | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | customer_id | first_name | last_name | city | state | clean_city | clean_state | changed | Rows changed | ||
| 2 | 1612 | Karen | Fisher | Houston | TX | ||||||
| 3 | 1617 | Lucas | Monroe | San Antonio | TX | ||||||
| 4 | 1627 | Valeria | Gallagher | Dallas | TX | ||||||
| 5 | 1636 | Patricia | Garcia | Dallas | TX | ||||||
| 6 | 1640 | Christine | Martinez | Houston | TX | ||||||
| 7 | 1642 | Eric | Moore | San Antonio | TX | ||||||
| 8 | 1643 | Donald | Turner | houston | TX | ||||||
| 9 | 1649 | Timothy | Brown | Houston | TX | ||||||
| 10 | 1653 | Jacob | Watson | Austin | TX | ||||||
| 11 | 1663 | William | Lewis | Dallas | TX | ||||||
| 12 | 1677 | Andrew | Russell | Houston | TX | ||||||
| 13 | 1678 | Betty | Bennett | San Antonio | TX | ||||||
| 14 | 1680 | Janet | Bennett | Houston | TX | ||||||
| 15 | 1682 | Nicole | Turner | Dallas | TX | ||||||
| 16 | 1683 | Linda | King | Houston | TX | ||||||
| 17 | 1688 | Marcus | Torres | Houston | TX | ||||||
| 18 | 1703 | Dylan | Perry | Dallas | TX | ||||||
| 19 | 1718 | Edward | James | Dallas | TX | ||||||
| 20 | 1726 | Mei | Vasquez | Houston | TX | ||||||
| 21 | 1743 | Chloe | Ramos | Dallas | TX | ||||||
| 22 | 1760 | Peter | Mitchell | Austin | tx | ||||||
| 23 | 1763 | Kathleen | Hill | Houston | TX | ||||||
| 24 | 1772 | Jennifer | Russell | Houston | TX | ||||||
| 25 | 1789 | Kyle | Miller | Houston | TX | ||||||
| 26 | 1799 | Sofia | Cruz | Austin | TX | ||||||
| 27 | 1801 | Katherine | Garcia | HOUSTON | TX | ||||||
| 28 | 1804 | Kyle | Adams | San Antonio | TX | ||||||
| 29 | 1811 | Timothy | Edwards | Austin | TX | ||||||
| 30 | 1816 | Michelle | Graham | San Antonio | TX | ||||||
| 31 | 1820 | Christine | Morales | Dallas | TX | ||||||
| 32 | 1845 | Debra | Ramirez | Houston | TX | ||||||
| 33 | 1867 | Jeffrey | Baker | San Antonio | TX | ||||||
| 34 | 1870 | Sarah | Davis | Houston | TX | ||||||
| 35 | 1871 | Ronald | Hayes | Dallas | TX | ||||||
| 36 | 1888 | Donald | Gomez | austin | TX | ||||||
| 37 | 1900 | Christopher | Taylor | Houston | tx | ||||||
| 38 | 1910 | Patrick | White | Houston | TX | ||||||
| 39 | 1929 | Mary | Morales | Houston | TX | ||||||
| 40 | 1935 | Logan | Young | Dallas | TX | ||||||
| 41 | 1945 | Logan | Kim | Dallas | TX | ||||||
| 42 | 1953 | Patrick | Barnes | San Antonio | TX | ||||||
| 43 | 1957 | Shirley | Gomez | Houston | TX | ||||||
| 44 | 1963 | Sofia | Ward | Houston | TX | ||||||
| 45 | 1966 | Karen | James | Dallas | TX | ||||||
| 46 | 1969 | Donald | Jackson | Dallas | TX | ||||||
| 47 | 1978 | Jerry | White | San Antonio | TX | ||||||
| 48 | 1987 | Luis | Hill | Dallas | TX | ||||||
| 49 | 1993 | Logan | Harrison | Houston | TX | ||||||
| 50 | |||||||||||
| 51 |
Loading the editor…
Reference solution
Mote checks your result
Press Check. Each right cell becomes a firefly in your lantern.
What Helen gets, and why
The lesson
Text that looks the same is not always the same. 'Houston ' has a trailing space you can’t see
in a cell. 'houston' and 'HOUSTON' look sloppy on a label and split one city into three in a
pivot or a chart. This sheet holds Texas customers who signed up since September 2025, straight
from the customer export, mess included.
Three cleaning functions
| Function | Does | D36 = ' austin ' becomes |
|---|---|---|
TRIM(text) |
removes spaces at both ends, squeezes runs of spaces inside to one | 'austin' |
PROPER(text) |
capital first letter of each word, the rest lower case | ' Austin ' |
UPPER(text) / LOWER(text) |
everything upper / lower case | ' AUSTIN ' |
They combine from the inside out. For the city:
F2 =PROPER(TRIM(D2))
and for the state, which is a two-letter code:
G2 =UPPER(TRIM(E2))
E16 holds 'TX ' with a trailing space; G16 becomes TX. D27 holds HOUSTON; F27 becomes
Houston.
Where PROPER goes wrong
PROPER capitalises after anything that isn’t a letter, which is right for San Antonio and
St. Louis and wrong for some names: PROPER("mcallen") gives Mcallen, and PROPER("o'brien")
gives O'Brien (right) but PROPER("it's") gives It'S. All the cities here survive it. Before
you run it over a column of surnames or brand names, scan the result.
Proving what changed: EXACT, not <>
Helen wants the changed rows marked. The obvious test is =D2<>F2. It fails quietly: Excel compares
text without looking at case, so "houston"<>"Houston" is FALSE. Written as
=OR(D2<>F2,E2<>G2), the flag catches the four rows with stray spaces (16, 25, 36 and 43) and
misses rows 8, 22, 27 and 37, where only the case changed.
EXACT(text1, text2) compares character by character, case included, and returns TRUE only for
an identical match. A row is unchanged when both columns match exactly, so the flag is the
opposite of that:
H2 =NOT(AND(EXACT(D2,F2),EXACT(E2,G2)))
J1 counts the TRUEs with =COUNTIF(H2:H49,TRUE): 8 of the 48 rows. Helen checks those eight
labels and trusts the rest.
Keep the raw column
Never clean a column in place. Keep city as exported and put clean_city next to it. If a rule
turns out wrong (a PROPER that mangled a name, say), you fix one formula and everything updates.
When the sheet goes to the print shop, copy the clean columns and paste them as values into a new
file.
For a variant that no function can fix, like a misspelling (Hoston), use Find & Replace
(Ctrl+H): find the wrong spelling, replace it with the right one, and tick “Match entire cell
contents” so Houston inside a longer name isn’t touched. Filter the column first to see every
variant at once: the filter list shows each distinct spelling.
Common mistakes
<>or=to detect changes. Both ignore case. UseEXACT.PROPERon the state.PROPER("tx")givesTx. Codes needUPPER.TRIMalone. It fixes'Houston 'but leaveshoustonandHOUSTONas they are.- Non-breaking spaces. Text pasted from a web page can carry character 160, which
TRIMleaves alone. in Excel,SUBSTITUTE(D2,CHAR(160)," ")turns it into a normal space first. Our export doesn’t have any, but you will meet them.
Lantern lit!
Practised: trimproperupperexactdata cleaning
- Solved
- No hints
- First run
