Learning Excel: Cleaning text
Cleaning up
Column F holds the names the way the guests typed them: with spaces at the front, all in capitals, or no capitals at all. Natalie can't print place cards like that.
TRIM
TRIM removes the spaces at the start and the end, and turns several spaces between words into one.
=TRIM(F2) turns Sadie's name into sadie de vere, without the two spaces at the front.
=TRIM(F2)
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | First name | Last name | Table | Mobile | As typed | Result | |
| 2 | Sadie | De Vere | sadie.devere@mail.co.uk | T01-COD | 07700 900 467 | sadie de vere | sadie de vere |
| 3 | James | Pearson | james.pearson@yahoo.co.uk | T01-STEAK | 07700 900 233 | JAMES PEARSON | |
| 4 | Amira | El Idrissi | amira@elidrissi.co.uk | T02-VEG | 07700 900 654 | amira el idrissi | |
| 5 | Liam | Walters | liam.w@gmail.com | T02-COD | 07700 900 566 | Liam Walters | |
| 6 | Faye | Clark | faye.clark@hotmail.co.uk | T03-STEAK | 07700 900 456 | faye clark | |
| 7 | Bill | Moss | bill@moss-bakery.co.uk | T03-VEG | 07700 900 321 | BILL moss | |
| 8 | Libby | Jennings | libby.jennings@yahoo.co.uk | T04-COD | 07700 900 899 | libby jennings | |
| 9 | Owen | Van Dyke | owen.vandyke@mail.co.uk | T04-STEAK | 07700 900 030 | owen VAN DYKE | |
| 10 |
PROPER
PROPER gives every word a capital first letter and makes the rest lower case. UPPER makes everything capitals, LOWER everything lower case.
You can put functions inside each other: =PROPER(TRIM(F2)) first removes the spaces and then fixes the capitals: Sadie De Vere.
=PROPER(TRIM(F2))
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | First name | Last name | Table | Mobile | As typed | Result | |
| 2 | Sadie | De Vere | sadie.devere@mail.co.uk | T01-COD | 07700 900 467 | sadie de vere | Sadie De Vere |
| 3 | James | Pearson | james.pearson@yahoo.co.uk | T01-STEAK | 07700 900 233 | JAMES PEARSON | |
| 4 | Amira | El Idrissi | amira@elidrissi.co.uk | T02-VEG | 07700 900 654 | amira el idrissi | |
| 5 | Liam | Walters | liam.w@gmail.com | T02-COD | 07700 900 566 | Liam Walters | |
| 6 | Faye | Clark | faye.clark@hotmail.co.uk | T03-STEAK | 07700 900 456 | faye clark | |
| 7 | Bill | Moss | bill@moss-bakery.co.uk | T03-VEG | 07700 900 321 | BILL moss | |
| 8 | Libby | Jennings | libby.jennings@yahoo.co.uk | T04-COD | 07700 900 899 | libby jennings | |
| 9 | Owen | Van Dyke | owen.vandyke@mail.co.uk | T04-STEAK | 07700 900 030 | owen VAN DYKE | |
| 10 |
SUBSTITUTE
SUBSTITUTE replaces one piece of text with another: you give the text, what has to go and what comes in its place.
=SUBSTITUTE(E2," ","") replaces every space with nothing: 07700900467, ready for the text message service.
=SUBSTITUTE(E2," ","")
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | First name | Last name | Table | Mobile | As typed | Result | |
| 2 | Sadie | De Vere | sadie.devere@mail.co.uk | T01-COD | 07700 900 467 | sadie de vere | 07700900467 |
| 3 | James | Pearson | james.pearson@yahoo.co.uk | T01-STEAK | 07700 900 233 | JAMES PEARSON | |
| 4 | Amira | El Idrissi | amira@elidrissi.co.uk | T02-VEG | 07700 900 654 | amira el idrissi | |
| 5 | Liam | Walters | liam.w@gmail.com | T02-COD | 07700 900 566 | Liam Walters | |
| 6 | Faye | Clark | faye.clark@hotmail.co.uk | T03-STEAK | 07700 900 456 | faye clark | |
| 7 | Bill | Moss | bill@moss-bakery.co.uk | T03-VEG | 07700 900 321 | BILL moss | |
| 8 | Libby | Jennings | libby.jennings@yahoo.co.uk | T04-COD | 07700 900 899 | libby jennings | |
| 9 | Owen | Van Dyke | owen.vandyke@mail.co.uk | T04-STEAK | 07700 900 030 | owen VAN DYKE | |
| 10 |
Try it yourself
In G2, make a tidy version of the name as typed and fill down to G9.
| A | B | C | D | E | F | G | H | |
|---|---|---|---|---|---|---|---|---|
| 1 | First name | Last name | Table | Mobile | As typed | Result | ||
| 2 | Sadie | De Vere | sadie.devere@mail.co.uk | T01-COD | 07700 900 467 | sadie de vere | ||
| 3 | James | Pearson | james.pearson@yahoo.co.uk | T01-STEAK | 07700 900 233 | JAMES PEARSON | ||
| 4 | Amira | El Idrissi | amira@elidrissi.co.uk | T02-VEG | 07700 900 654 | amira el idrissi | ||
| 5 | Liam | Walters | liam.w@gmail.com | T02-COD | 07700 900 566 | Liam Walters | ||
| 6 | Faye | Clark | faye.clark@hotmail.co.uk | T03-STEAK | 07700 900 456 | faye clark | ||
| 7 | Bill | Moss | bill@moss-bakery.co.uk | T03-VEG | 07700 900 321 | BILL moss | ||
| 8 | Libby | Jennings | libby.jennings@yahoo.co.uk | T04-COD | 07700 900 899 | libby jennings | ||
| 9 | Owen | Van Dyke | owen.vandyke@mail.co.uk | T04-STEAK | 07700 900 030 | owen VAN DYKE | ||
| 10 |
Ready for more?
The full lesson has 4 exercises, from easy to challenging, with hints, points and a streak you can build.
Start the lesson