How to Fix If TRIM Function Not Working in Excel: 2 Solutions

The Trim Function can trim extra leading and trailing spaces within text cells in Excel. Normally, the spaces given before a word are called leading spaces.

How the TRIM Function Works in Excel

The spaces given at the end of a word are called Trailing spaces.

How the TRIM Function Works in Excel

The TRIM Function is,

=TRIM(text)

Where text is the required argument for the TRIM Function to trim text or numbers.

From our dataset, we’ll learn how the TRIM function works. Please follow the instructions to learn the working procedure of the TRIM function!

Steps:

  • Select a cell where we will type the TRIM function; from our dataset, we select cell C5 and type the TRIM function. The TRIM function is,
=TRIM(B5)

How the TRIM Function Works in Excel

  • Press Enter to remove spaces before and after Am a z o n, as given in the screenshot below.

  • Place your cursor on the Bottom-Right of cell C5, and an autoFill sign will appear in front of you. Drag it downward.
  • By dragging the autoFill sign downward, you can trim spaces to column B in column C.

How the TRIM Function Works in Excel


Method 1 – Apply the SUBSTITUTE Function to Fix the TRIM Function Not Working

1.1 Insert the Basic SUBSTITUTE Function

Steps:

  • Select a cell where we’ll apply the SUBSTITUTE function. We’ll select cell D5 from our dataset to apply the SUBSTITUTE function.

Insert the Basic SUBSTITUTE Function

  • Enter the SUBSTITUTE function in the Formula Bar. The SUBSTITUTE function in the Formula Bar is,
=SUBSTITUTE(B5, " ", "")

Insert the Basic SUBSTITUTE Function

  • Press Enter to get Amazon in cell D5 as the return of the SUBSTITUTE function.

  • Place your cursor on the Bottom-Right side of cell D5 and an autoFill sign pops up.
  • Drag the autoFill sign downward.

Insert the Basic SUBSTITUTE Function

  • After completing the above process, you will be able to replace Spaces with Empty in the entire column D by applying the SUBSTITUTE function; the TRIM function can not do that, as shown in the screenshot.

Insert the Basic SUBSTITUTE Function


1.2 Use of the SUBSTITUTE and CHAR Functions

Steps:

  • Select cell C5 from our dataset to apply the TRIM, SUBSTITUTE, and CHAR functions to remove extra spaces.

Use of the SUBSTITUTE and CHAR Functions

  • Enter the TRIM, SUBSTITUTE, and CHAR functions in the Formula Bar and Type the SUBSTITUTE and CHAR functions inside the TRIM function in the function dialog box. The formula is:
=TRIM(SUBSTITUTE(B5,CHAR(160), 0))

Use of the SUBSTITUTE and CHAR Functions

  • Press Enter to get Am a z o n as the output of these functions.

  • Place your cursor on the Bottom-Right side of cell C5, and an autoFill sign pops up.
  • Drag the autoFill sign downward to get your desired output.

Read More: How to Trim Right Characters and Spaces in Excel


Method 2 – Perform Find & Select Command to Fix TRIM Function Not Working

Steps:

  • From your Home tab, go to Home → Editing → Find & Select → Replace

Perform Find & Select Command to Fix TRIM Function Not Working

  • After clicking on the Replace option, a Find and Replace window pops up.

  • From the Find and Replace window, Give Space in the Find what box and Replace with box keeps
  • Click on the Replace All box.

  • A new dialog box named Microsoft Excel appears, showing All done. We made 54 replacements.
  • Press OK.

Perform Find & Select Command to Fix TRIM Function Not Working

  • After completing the above process, you will be able to replace Space with Empty, which the TRIM function can not do, as shown in the screenshot below.

Perform Find & Select Command to Fix TRIM Function Not Working


Things to Remember

If the Excel TRIM is not working, you may run into issues besides non-breaking spaces. You may face those problems, particularly if you’re working with HTML-based source material.

The SUBSTITUTE function is useful for changing any ASCII code with any other code.


Download the Practice Workbook

Download this workbook to practice.


Related Articles 


<< Go Back to Excel TRIM Function | Excel Functions | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Md. Abdur Rahim Rasel
Md. Abdur Rahim Rasel

MD. ABDUR RAHIM is a marine engineer proficient in Excel and passionate about programming with VBA. He views programming as an efficient means to save time while managing data, handling files, and engaging with the internet. His interests extend to Rhino3D, Maxsurf C++, AutoCAD, Deep Neural Networks, and Machine Learning, reflecting his versatile skill set. He earned a B.Sc in Naval Architecture & Marine Engineering from BUET, and now he has become a content developer, creating technical content... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo