Hiring Partners
Segilola Resources Operating LimitedTaviatech TechnologiesFCMBMTN NigeriaAdvans La Fayette Microfinance BankAboki AfricaFirst Bank of NigeriaOPay
โ† Data Cleaning in Excel ยท Lesson 5 of 9

Module Four

๐Ÿ“– Every lesson in this course is free to read right here, no account needed. Create a free account to track your progress, take the exam, and earn your certificate.
5

Module 4: Cleaning Text Data with Excel Functions

Module Overview

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:

  • Remove unnecessary spaces from text.
  • Remove unwanted characters.
  • Change text to uppercase and lowercase.
  • Make names look properly formatted.
  • Extract specific parts of text.
  • Combine information from different cells.

Lesson 1: Understanding Text Data in Excel

Text data is information made up of letters, words, symbols, or a combination of these characters.

Examples of text data include:

  • Student names: David James
  • Country names: Nigeria
  • Email addresses: david@gmail.com
  • School names: Bright Future Academy
  • Product names: Laptop Computer

Text data sometimes contains mistakes that make it difficult to use. Excel has special functions that help us correct these problems.

Lesson 2: Removing Extra Spaces with the TRIM Function

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.

How to Use the TRIM Function

Follow these steps:

  1. Open Microsoft Excel.
  2. Enter the text David James into cell A2.
  3. Click cell B2.
  4. Type the formula below:

Formula:

=TRIM(A2)
  1. Press Enter.
  2. Excel will display David James without the extra spaces.

Remember: TRIM removes extra ordinary spaces but keeps a single space between words.

Lesson 3: Removing Unwanted Characters with CLEAN

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.

How to Use CLEAN

Follow these steps:

  1. Enter some text into cell A2.
  2. Click cell B2.
  3. Type the formula:
=CLEAN(A2)
  1. Press Enter.
  2. Excel will remove supported non-printable characters.

Important: CLEAN does not remove every unwanted symbol or unusual character. You may need other functions or Find and Replace for additional cleaning.

Using TRIM and CLEAN Together

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.

Lesson 4: Correcting Text with UPPER, LOWER, and PROPER

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.

1. UPPER Function

UPPER changes all letters in a text into capital letters.

Example:

=UPPER(A2)

If cell A2 contains:

nigeria

The result will be:

NIGERIA

2. LOWER Function

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

3. PROPER Function

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

Quick Comparison

Function Original Text Result
UPPER Nigeria NIGERIA
LOWER NIGERIA nigeria
PROPER nIGERIA Nigeria

Lesson 5: Extracting Text with LEFT, RIGHT, and MID

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.

1. LEFT Function

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.

2. RIGHT Function

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.

3. MID Function

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.

Understanding the Three Functions

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)

Lesson 6: Combining Text with CONCAT and TEXTJOIN

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.

1. CONCAT Function

CONCAT joins text from different cells or values.

Imagine:

  • Cell A2 contains David.
  • Cell B2 contains James.

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.

2. TEXTJOIN Function

TEXTJOIN combines information from several cells and allows you to choose what should appear between them.

For example, imagine:

  • A2 contains David.
  • B2 contains James.
  • C2 contains Ade.

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.

Practical Project: Clean a Customer Database

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.

Unclean Customer Dataset

First Name Last Name Country Customer Code
david JAMES nigeria CRM2026001
MARY bELLO NIGERIA CRM2026002
peter BROWN Nigeria CRM2026003

Your Practical Tasks

  1. Enter the dataset into Excel.
  2. Use TRIM to remove unnecessary spaces from names.
  3. Use PROPER to correct the formatting of customer names.
  4. Use UPPER to change country names to capital letters.
  5. Use LEFT to extract CRM from the customer codes.
  6. Use MID to extract the year 2026 from the customer codes.
  7. Use RIGHT to extract the last three digits of each customer code.
  8. Use CONCAT to combine first names and surnames into full names.
  9. Save your workbook as Cleaned_Customer_Database.xlsx.

Module 4 Summary

In this module, you have learned how to:

  • Understand and clean text data in Excel.
  • Remove unnecessary spaces using TRIM.
  • Remove non-printable characters using CLEAN.
  • Change text formats using UPPER, LOWER, and PROPER.
  • Extract text using LEFT, RIGHT, and MID.
  • Combine text using CONCAT and TEXTJOIN.

Module 4 Assessment

Answer the following questions:

  1. What is text data?
  2. Which Excel function removes unnecessary spaces?
  3. What does the CLEAN function do?
  4. Which function changes text into capital letters?
  5. What is the difference between UPPER and LOWER?
  6. Which function makes the first letter of each word capital?
  7. What does LEFT(A2,3) do?
  8. Which function extracts characters from the middle of a text?
  9. What is the purpose of CONCAT?
  10. What is the difference between CONCAT and TEXTJOIN?

Congratulations!

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.

๐Ÿ† Get Certified

๐Ÿ”’

Earn this certificate

Every lesson is already free to read. Sign up, finish the lessons, pass the exam (โ‚ฆ2,000 or 20,000 coins), and get a verified certificate with your name on it.

๐ŸŽ“ Sign Up to Get Certified
๐Ÿ› ๏ธ Practice Tools
Hands-on simulators & labs - subscription required.
โ†’
๐ŸŽฏ Internship Tasks
Real-world tasks to build your portfolio - unlock them with a subscription.
โ†’