Imagine you are working with a school database containing the names, addresses, email addresses, and phone numbers of students. Some names may be written in capital letters, others in small letters, and some may have unwanted spaces.
Before analysing this information, you may need to organise and clean it. Microsoft Excel provides text functions that help you change, combine, extract, and clean text without typing everything again.
In this module, you will learn how to use important Excel text functions to prepare information for data analysis.
By the end of this module, you should be able to:
Text functions are Excel formulas that help you work with words, letters, numbers stored as text, and other characters.
For example, imagine a spreadsheet containing these names:
You can use Excel text functions to make these names look neat and consistent.
The UPPER function changes all letters in a text value to capital letters.
=UPPER(text)
Assume a student's name is stored in cell A2 as john ade.
Enter this formula in B2:
=UPPER(A2)
Result: JOHN ADE
This function is useful when preparing names, product labels, and other records that should appear in capital letters.
The LOWER function changes all letters in a text value to small letters.
=LOWER(text)
Assume cell A2 contains the text JOHN ADE.
Enter:
=LOWER(A2)
Result: john ade
LOWER can help make email addresses and other text records consistent.
The PROPER function changes the first letter of each word to a capital letter and changes the remaining letters to small letters.
=PROPER(text)
Suppose cell A2 contains:
MARY JAMES
Enter:
=PROPER(A2)
Result: Mary James
This function is useful when organising students' names, employee records, customer lists, and contact databases.
Sometimes information is stored in separate cells, but you need to bring it together.
For example, a student's first name may be in cell A2 while the surname is in cell B2. You can use CONCAT to join them.
=CONCAT(text1, text2, ...)
| First Name | Surname |
|---|---|
| Ade | Johnson |
| Mary | James |
| David | Okoro |
To combine the first name and surname with a space between them, enter:
=CONCAT(A2," ",B2)
Result: Ade Johnson
The quotation marks containing a space tell Excel to leave a gap between the two names.
You can also use the ampersand (&) symbol to combine text.
=A2&" "&B2
This produces the same result: Ade Johnson.
These functions help you extract specific characters from a text value. Extracting means taking only the part of the text you need.
LEFT extracts characters from the beginning or left side of a text value.
Syntax:
=LEFT(text, num_chars)
Assume cell A2 contains the student ID CRM2026. To extract the first three characters, enter:
=LEFT(A2,3)
Result: CRM
RIGHT extracts characters from the end or right side of a text value.
Syntax:
=RIGHT(text, num_chars)
To extract the last four characters from CRM2026, enter:
=RIGHT(A2,4)
Result: 2026
MID extracts characters from the middle of a text value. You tell Excel where to start and how many characters to extract.
Syntax:
=MID(text, start_num, num_chars)
Suppose cell A2 contains CRM2026. To extract the four characters starting from the fourth position, enter:
=MID(A2,4,4)
Result: 2026
Sometimes people accidentally enter extra spaces before, between, or after words. These spaces can make data difficult to organise.
The TRIM function removes unnecessary spaces from text. It keeps a single space between words.
=TRIM(text)
Assume cell A2 contains:
Mary James
Enter:
=TRIM(A2)
Result: Mary James
TRIM is especially useful when cleaning customer names, school records, and imported spreadsheet data.
LEN counts the number of characters in a text value. Characters include letters, numbers, symbols, and spaces.
=LEN(text)
Assume cell A2 contains:
CRMNuggets
Enter:
=LEN(A2)
Result: 9
Excel counts each letter in the word. If the text contains spaces, those spaces are counted too.
SUBSTITUTE replaces specific text with another text inside a cell.
For example, a company may want to replace an old product name with a new one in its records.
=SUBSTITUTE(text, old_text, new_text, [instance_num])
Suppose cell A2 contains:
Old Product - Rice
Enter:
=SUBSTITUTE(A2,"Old Product","New Product")
Result: New Product - Rice
Imagine a school in Ibadan has received a spreadsheet containing student names in different formats. Your task is to clean and organise the names.
| Original Name | Clean Name |
|---|---|
| JOHN ADE | John Ade |
| mary james | Mary James |
| PETER DAVID | Peter David |
| GRACE OKORO | Grace Okoro |
Assume the original names are stored in column A. Enter this formula in B2:
=PROPER(TRIM(A2))
This formula combines two functions. TRIM removes unnecessary spaces, while PROPER makes the first letter of each word capital.
Drag the formula down to clean the remaining names.
| Function | Purpose | Example |
|---|---|---|
| UPPER | Changes text to capital letters. | =UPPER(A2) |
| LOWER | Changes text to small letters. | =LOWER(A2) |
| PROPER | Capitalises the first letter of each word. | =PROPER(A2) |
| CONCAT | Joins text together. | =CONCAT(A2," ",B2) |
| LEFT | Extracts characters from the beginning. | =LEFT(A2,3) |
| RIGHT | Extracts characters from the end. | =RIGHT(A2,4) |
| MID | Extracts characters from the middle. | =MID(A2,4,4) |
| TRIM | Removes unnecessary spaces. | =TRIM(A2) |
| LEN | Counts the number of characters. | =LEN(A2) |
| SUBSTITUTE | Replaces specific text. | =SUBSTITUTE(A2,"Old","New") |
A computer training centre in Lagos has collected the names and identification numbers of five students. Your task is to clean and analyse the information using Excel text functions.
| Student Name | Student ID |
|---|---|
| JOHN ADE | CRM202601 |
| MARY JAMES | CRM202602 |
| peter david | CRM202603 |
| GRACE OKORO | CRM202604 |
| DAVID EZE | CRM202605 |
In this module, you learned how to use Excel text functions to organise and clean information.
These functions are useful when preparing student records, customer databases, employee information, product lists, and other datasets for analysis.
In Module 6, you will learn about Date and Time Functions in Excel. You will discover how to work with dates, calculate the number of days between two dates, extract years and months, and analyse time-based information.