Building and Cleaning: Putting It Together
About this lesson
Cleaning imported text usually means four things. Trim the spaces, fix the case, replace the separators, and convert anything numeric back into a number.
- clean an imported column with TRIM, SUBSTITUTE, PROPER and VALUE.
- build a label from several cells with & and TEXT.
The idea
The order matters less than doing all four. But trim first. It removes the thing that stops values matching, and everything after it is easier to check. Functions nest from the inside out, so the one written innermost runs first.
The part people skip is checking. Cleaning is invisible work. The cell looked fine before and looks fine after. So it is entirely possible to apply TRIM to the wrong column and never find out. Comparing a length before and after, or asking ISNUMBER whether a conversion really converted, takes one formula. It turns a belief into a fact. Every cleaning step in this module has a matching check, and the check is the half to keep on the sheet.
The mistake to watch for
Cleaning without checking. The cell looked fine before and looks fine after. So TRIM applied to the wrong column, or a conversion that never converted, is invisible. Compare a length before and after, or ask ISNUMBER whether the number is now a number. One formula turns a belief that the cleaning worked into a fact.
Read more about this
Where this comes up again
This lesson needs JavaScript to run. Everything below is the lesson in full, but you cannot type into the grid or be marked.
Nest functions to fix two problems in one formula.
In B2, type:
=PROPER(TRIM(A2))
| Row | A | B | C | D | E | F | G |
|---|---|---|---|---|---|---|---|
| 1 | Raw | Cleaned | Check | ||||
| 2 | ashworth & co | ||||||
| 3 | PO/2024/0417 | ||||||
| 4 | 0088 | ||||||
| 5 | Dilys | Pritchard | |||||
| 6 | |||||||
| 7 | |||||||
| 8 |
Every step
-
Nest functions to fix two problems in one formula. In
B2, type:=PROPER(TRIM(A2)). -
In
B3, replace every slash inA3with a hyphen. -
B4should add 1 to the number inA4, butA4holds text. FixB4. Remember:VALUEturns text into a number. -
CONCATjoins pieces of text together. InC5, joinA5andB5with a space, usingCONCAT. Remember: the space between them needs quotes too. -
Check the tidying worked. Read
=LEN(TRIM(A2))and say what it returns. -
In
C3, show the length ofA3as text, no decimals. Shape:=TEXT(LEN(cell),"0").