Home>Blogs>Power Pivot>How to use SUBSTITUE Function in Excel with Examples
Power Pivot

How to use SUBSTITUE Function in Excel with Examples

Have you ever needed to clean up messy text in Excel but weren’t sure how? Don’t worry! In this post, I’ll Walk you through how to use the SUBSTITUE Function in Excel. By the time we’re done, you’ll know exactly how to use it to remove unwanted line breaks or replace specific text quickly and easily.

What Is the SUBSTITUE Function in Excel?

SUBSTITUE Function in Excel
SUBSTITUE Function in Excel

First, let’s talk about what the SUBSTITUE Function in Excel does. Simply put, it allows you to replace specific text in a cell with something else. This is super helpful when you’re dealing with large sets of data that might have formatting issues or extra characters that you don’t need.

For example, if your data has unnecessary line breaks or extra spaces, the SUBSTITUE Function in Excel can clean that up for you in seconds. Sounds good, right? Let’s see it in action!

Why Use the SUBSTITUTE Function?

SUBSTITUTE Function
SUBSTITUTE Function

Before we jump into the example, let’s look at why you’ll love this function:

  • It’s Quick: No need to edit cells one by one.
  •  It’s Accurate: Ensures you get consistent results every time.
  • It’s Flexible: You can use it to replace any text, not just spaces or line breaks.

The Example: Cleaning Up a Product List

Let’s look at the data we’ll be working with in this example. We have a simple table with three columns:

  1. Order ID (Column A)
  2. Product Name (Column B)
  3. Deleted Line Break (Column C)

As you can see, the “Deleted Line Break” column contains unwanted line breaks that make the data look untidy. Now, let’s fix that!

The Problem: Unwanted Line Breaks

If you look closely at the “Deleted Line Break” column, you’ll notice that some product names have extra line breaks. This makes the data hard to read and work with, but don’t worry—it’s easy to clean up using the SUBSTITUTE function.

The Solution: Using the SUBSTITUTE Function

Now, here’s how we can solve the problem.

We’ll use the SUBSTITUTE formula to remove the line breaks. The line break in Excel is represented by CHAR (10), so we’ll replace it with a space ” “.

Here’s the formula you’ll need:

=SUBSTITUTE (B4, CHAR (10), ” “)

Let’s break this down:

  1. B4: This is the cell that contains the text we want to change.
  2. CHAR (10): This is the line break character in Excel.
  3. ” “: We want to replace the line break with a space.

Step-by-Step: How to Apply the Formula

Here’s how you can apply this formula step by step:

  • Click on the cell where you want the result: Let’s say you start with cell C4.
  • Enter the formula: Type =SUBSTITUTE (B4, CHAR (10), ” “) into the formula bar.
  • Press Enter: The formula will automatically remove the line break in that cell.
  • Copy the formula down: Click the small square in the bottom-right corner of the cell and drag it down to apply the formula to the other rows.

Final Thoughts

The SUBSTITUTE function is a powerful tool that can make cleaning up your Excel data much easier. Whether you need to remove line breaks, extra spaces, or any other unwanted text, you can do it quickly and accurately with this function.

If you found this guide helpful, don’t forget to check out our YouTube video for a visual walkthrough of the SUBSTITUE Function in Excel. And feel free to share this post with others who might benefit from learning this awesome Excel trick!

Visit our YouTube channel to learn step-by-step video tutorials

Youtube.com/@PKAnExcelExpert

 

 

View this post on Instagram

 

A post shared by Priyendra Kumar (@pkanexcelexpert)

 

Click hare to download the practice file

 

PK
Meet PK, the founder of PK-AnExcelExpert.com! With over 15 years of experience in Data Visualization, Excel Automation, and dashboard creation. PK is a Microsoft Certified Professional who has a passion for all things in Excel. PK loves to explore new and innovative ways to use Excel and is always eager to share his knowledge with others. With an eye for detail and a commitment to excellence, PK has become a go-to expert in the world of Excel. Whether you're looking to create stunning visualizations or streamline your workflow with automation, PK has the skills and expertise to help you succeed. Join the many satisfied clients who have benefited from PK's services and see how he can take your Excel skills to the next level!
https://www.pk-anexcelexpert.com