The CLEAN
function in Excel is used to remove all non-printable characters from text. This can be particularly useful when dealing with data imported from other applications that might include characters that are not printable.
Syntax
excelCLEAN(text)
text
: The text string from which you want to remove non-printable characters.
Example
Suppose you have the following text in cell A1 that includes non-printable characters:
Hello, World!
The character after the comma and before "World" is a non-printable character (ASCII code 127).
- Basic Usage:
- If you want to clean this text:
- Formula:
=CLEAN(A1)
- Result:
Hello, World!
Practical Example
Imagine you have a column of data with various non-printable characters, and you want to clean the entire column.
Enter the following text in cell A1 (including non-printable characters):
arduino"Hello, World!"
In cell B1, enter the formula:
excel=CLEAN(A1)
The result in cell B1 will be:
Hello, World!
Step-by-Step Example
Input Data:
- In cell A1, enter:
Data with non-printable characters: Hello
- The character after "characters:" and before "Hello" is a non-printable character (ASCII code 12, form feed).
- In cell A1, enter:
Use the CLEAN Function:
- In cell B1, enter the formula:excel
=CLEAN(A1)
- In cell B1, enter the formula:
Result:
- The result in cell B1 will be:
Data with non-printable characters: Hello
- The non-printable character is removed.
- The result in cell B1 will be:
Combining CLEAN with Other Functions
You can also combine CLEAN
with other functions like TRIM
to remove both non-printable characters and extra spaces.
Input Data:
- In cell A1, enter:
Data with non-printable characters: Hello
(note the extra spaces before and after the text).
- In cell A1, enter:
Combine CLEAN and TRIM:
- In cell B1, enter the formula:excel
=TRIM(CLEAN(A1))
- In cell B1, enter the formula:
Result:
- The result in cell B1 will be:
Data with non-printable characters: Hello
- Both the non-printable character and extra spaces are removed.
- The result in cell B1 will be:
These examples illustrate how the CLEAN
function can be used to sanitize text data in Excel, making it more suitable for further processing or analysis.
No comments:
Post a Comment