Excel - CLEAN Function



CLEAN Function

The Excel CLEAN function eradicates all nonprintable characters from the designated cell referring to a text. Business analysts and other Excel data players may benefit from the CLEAN function while importing datasets from external sources into Excel that contain useless line breaks and a bundle of nonprintable characters. It was first introduced in Excel 2000 and is supported in all subsequent Excel versions.

In the ANSI character set, the code ranges from 1 to 31 denotes nonprintable characters. The CLEAN function eliminates carriage returns, line feeds, and many more nonprintable characters.

Compatibility

This prominent CLEAN function is compatible with the following versions of MS Excel −

  • Excel for Microsoft 365
  • Excel for Microsoft 365 for Mac
  • Excel for the web
  • Excel 2024
  • Excel 2024 for Mac
  • Excel 2021
  • Excel 2021 for Mac
  • Excel 2019
  • Excel 2016
  • Excel 2013
  • Excel 2010
  • Excel 2007

Syntax

The syntax of the CLEAN function is as follows −

CLEAN (text)

Arguments

The CLEAN function contains only one argument –

Argument Description Required / Optional
Text A cell reference from where you can eliminate the unwanted nonprintable characters. Required

Point To Remember

  • The CLEAN function will not work for the ANSI character set range from 32 to 255, as the exact input text string will be retrieved.
  • If the argument contains the error value, then the CLEAN function will return the same error value.

Use of CLEAN Function

Below are the crucial steps to execute the CLEAN function −

  • Open a desired Excel worksheet.
  • Import the dataset from the external source or enter the sample dataset.
  • Select the targeted cell, type the =sign, and then write the CLEAN(cell reference).
  • Hit the Enter tab to get the result.

Examples of CLEAN Functions

Practice the following example to learn the use of the CLEAN function in Excel.

Example 1: Remove Non-Printable Characters Using CLEAN Function

The CLEAN function is used to remove non-printable characters from a text string.

Solution

Step 1 − Consider the sample dataset comprises two columns named Text and Function. Choose the C2 cell and write the formula =CLEAN(B2).

Write The Formula =CLEAN(B2)

Step 2 − Once you press the Enter, the CLEAN function will retrieve the "Accessibility" result.

CLEAN Function Retrieve The Accessibility

In a similar way, write the formula =CLEAN(B3) in the C3 cell and press the Enter tab.

Write The Formula CLEAN in C3 Cell

Therefore, the CLEAN function will return the "Adaptability" as a result.

CLEAN Function Return The Adaptability

Example 2: Remove Carriage Return Using CLEAN Function

The CLEAN function is use to remove unwanted characters from text, like blank spaces or special codes that don't print, such as the end of line marker often found in text files.

Solution

Step 1 − First, assume the sample dataset where nonprintable characters are specified in the B column.

How to Remove Carriage Return Using CLEAN

Step 2 − After that, to remove the line breaks and other nonprintable characters in the B2 cell, enter the formula =CLEAN(B2) in C2 cell.

Enter The Formula CLEAN in C2 cell

And then, hit the Enter tab to extract the text without nonprintable character.

Extract Text Without Nonprintable

As you can notice in this example, the text string is displayed consecutively without the line breaks.

Step 3 − Afterward, select the C2 cell and drag the + sign(Fill handle) located at right bottom corner of the cell and place it into the C4 cell.

Data Cleaning Process is Done

Therefore, the data cleaning process is done through the CLEAN function.

Download Practice Sheet

You can download and use the sample data sheet to practice the CLEAN function.

Advertisements