Welcome to Module 4! In this module, you will learn how to clean and organise text information using Microsoft Excel functions.
Imagine you are working with a customer database containing hundreds of names, email addresses, and locations. Some names have unnecessary spaces, some are written in capital letters, and others have unwanted characters.
Instead of correcting every cell manually, you can use Excel functions to do the work faster.
In this module, you will learn how to:
Text data is information made up of letters, words, symbols, or a combination of these characters.
Examples of text data include:
Text data sometimes contains mistakes that make it difficult to use. Excel has special functions that help us correct these problems.
Sometimes, people accidentally type too many spaces before, between, or after words.
For example:
| Unclean Text | Clean Text |
|---|---|
| David James | David James |
| Mary Bello | Mary Bello |
| Peter Brown | Peter Brown |
Excel provides a function called TRIM to remove unnecessary spaces from text.
Follow these steps:
Formula:
=TRIM(A2)
Remember: TRIM removes extra ordinary spaces but keeps a single space between words.
Sometimes, text copied from websites or other computer programs contains invisible or unwanted control characters.
These characters can make your data difficult to organise.
Excel provides the CLEAN function to remove many non-printable characters from text.
Follow these steps:
=CLEAN(A2)
Important: CLEAN does not remove every unwanted symbol or unusual character. You may need other functions or Find and Replace for additional cleaning.
You can combine both functions to remove unnecessary spaces and non-printable characters.
=TRIM(CLEAN(A2))
This is useful when cleaning text copied from different sources.
Sometimes, names and other text are written in different letter styles. For example, one person may write NIGERIA, another may write nigeria, while someone else writes Nigeria.
Excel provides three useful functions to help make text consistent.
UPPER changes all letters in a text into capital letters.
Example:
=UPPER(A2)
If cell A2 contains:
nigeria
The result will be:
NIGERIA
LOWER changes all letters in a text into small letters.
Example:
=LOWER(A2)
If cell A2 contains:
DAVID JAMES
The result will be:
david james
PROPER changes the first letter of each word to a capital letter and makes the other letters lowercase.
Example:
=PROPER(A2)
If cell A2 contains:
mARY bELLO
The result will be:
Mary Bello
| Function | Original Text | Result |
|---|---|---|
| UPPER | Nigeria | NIGERIA |
| LOWER | NIGERIA | nigeria |
| PROPER | nIGERIA | Nigeria |
Imagine you have a list of customer identification numbers. Each identification number contains different pieces of information. Sometimes, you only need a small part of the text.
Excel provides LEFT, RIGHT, and MID functions to help you extract specific characters from a text.
LEFT extracts characters from the beginning of a text.
Imagine cell A2 contains:
CRM2026001
Use this formula:
=LEFT(A2,3)
Result: CRM
The number 3 tells Excel to extract the first three characters.
RIGHT extracts characters from the end of a text.
Using the same identification number:
=RIGHT(A2,3)
Result: 001
Excel extracts the last three characters.
MID extracts characters from a particular position inside a text.
For example:
=MID(A2,4,4)
Result: 2026
This formula tells Excel to start at the fourth character and extract four characters.
| Function | Purpose | Example |
|---|---|---|
| LEFT | Extracts from the beginning. | =LEFT(A2,3) |
| RIGHT | Extracts from the end. | =RIGHT(A2,3) |
| MID | Extracts from the middle. | =MID(A2,4,4) |
Sometimes, information is stored in separate cells, but you want to bring it together.
For example, a student's first name may be in cell A2 while the surname is in cell B2.
Excel allows you to combine these names using CONCAT and TEXTJOIN.
CONCAT joins text from different cells or values.
Imagine:
Use this formula:
=CONCAT(A2," ",B2)
Result: David James
The quotation marks containing a space tell Excel to place a space between the two names.
TEXTJOIN combines information from several cells and allows you to choose what should appear between them.
For example, imagine:
Use this formula:
=TEXTJOIN(" ",TRUE,A2:C2)
Result: David James Ade
The space inside the quotation marks separates the names. TRUE tells Excel to ignore empty cells.
Congratulations! You have been given a customer database belonging to a small business in Ibadan.
The business wants you to clean the customer names and organise the information.
| First Name | Last Name | Country | Customer Code |
|---|---|---|---|
| david | JAMES | nigeria | CRM2026001 |
| MARY | bELLO | NIGERIA | CRM2026002 |
| peter | BROWN | Nigeria | CRM2026003 |
In this module, you have learned how to:
Answer the following questions:
You have successfully completed Module 4! You can now use Excel functions to clean names, remove unnecessary spaces, extract information, and combine text.
In Module 5, you will learn how to correct dates, numbers, currency, phone numbers, and other formatting problems in Excel.