TRIM


removes excess spaces from a text string.

Syntax:

TRIM(text)

returns text with any leading or trailing spaces removed, and with any multiple spaces replaced with a single space.

Example:

TRIM("    Good    Morning   ")

returns Good Morning.


Application:

Cleaning Up a Customer Contact List


Imagine you're managing a customer contact list that was compiled by several different people. As a result, the data in the "Full Name" column is messy, with leading, trailing, and multiple spaces between words. This inconsistent formatting makes it difficult to sort the list correctly or use the names in a mail merge.


Here's a sample of the raw data:

Raw Name

A
1
John Doe
2
Jane Smith
3
Peter Jones
4
Sarah Williams
5
Michael Brown

To clean this data and create a consistent "Clean Name" column, you would use the TRIM function.


Step-by-step process:

  1. Select the cell where you want the first cleaned name to appear (in this case, cell B1).
  2. Enter the TRIM function by typing TRIM(A1).
    • A1 is the cell containing the raw name you want to clean.


After applying the formula, your table will look like this:

Raw Name

Clean Name

A
B
1
John Doe
John Doe
2
Jane Smith
Jane Smith
3
Peter Jones
Peter Jones
4
Sarah Williams
Sarah Williams
5
Michael Brown
Michael Brown

As you can see, the TRIM function successfully removed the leading spaces from "John Doe" and "Peter Jones," the trailing spaces from "Jane Smith," and the multiple spaces between the first and last names in all the examples, leaving only single spaces. The "Clean Name" column is now properly formatted and ready for use in other tasks.





This page is protected by Google reCAPTCHA. Privacy - Terms.
 
Built using Zapof