Fix Excel TRIM Formula Displaying as Text Not Working
Question details
The Excel TRIM function displays the formula text itself instead of executing and removing extra spaces from the targeted cells.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Trying to clean up text data by removing leading and trailing spaces using the TRIM function.
- Observed behavior
- The cell displays the actual typed formula as ordinary text rather than evaluating it to show the cleaned result.
Ensure that you haven't accidentally typed a single quote (') before the equals sign in your formula, or enabled the 'Show Formulas' view, as both will force Excel to display the formula as text regardless of cell formatting.
Change Cell Format to General and Re-enter Formula
This is the most common and effective fix. When cells are formatted as 'Text', Excel ignores formula calculations. Switching the format to 'General' allows Excel to calculate the formula properly.
If a cell's formatting was set to Text before you typed the formula, Excel will interpret your keystrokes literally. You must change the format back to General and force Excel to recalculate the cell.
Highlight the specific cells where your TRIM formula is displaying as text instead of functioning correctly.
Go to the 'Home' tab on the top ribbon, locate the 'Number' group, click the format dropdown menu (which likely says 'Text'), and select 'General'.
Double-click the cell with the formula (or click directly into the formula bar at the top) and press 'Enter'. This forces Excel to re-evaluate the cell as a formula.

Test the Formula in a New Workbook
If changing the format doesn't work, the issue might be specific to the original document's settings or corruption. Testing in a fresh file isolates the problem.
Easily Clean Up Text Data with WPS Spreadsheet
WPS Spreadsheet provides a seamless and highly compatible environment for your data cleaning tasks. It perfectly handles standard Excel formulas like TRIM, and its intuitive interface makes cell formatting and formula evaluation straightforward.
- 1. Open your document: Launch WPS Spreadsheet and open the file containing the text data you need to clean.
- 2. Prepare an adjacent column: Select the empty cells next to your data and ensure their format is set to 'General' in the Home tab.
- 3. Apply the TRIM formula: Type =TRIM(cell_reference) in the first empty cell and press Enter to remove extra spaces.
- 4. Drag to fill: Click and drag the small square at the bottom-right corner of the cell to apply the TRIM formula to the rest of your list.

Frequently Asked Questions
Why does Excel show my formula instead of the calculated answer?
This usually happens for two reasons: either the cell is formatted as 'Text' before you typed the formula, or the 'Show Formulas' feature is accidentally turned on. You can toggle 'Show Formulas' off by pressing 'Ctrl + `' (grave accent) on your keyboard or clicking it under the Formulas tab.
Can the TRIM function remove non-breaking spaces in Excel?
No, the standard TRIM function only removes regular space characters. To remove non-breaking spaces (often found when copying data from web pages), you need to combine the TRIM and SUBSTITUTE functions. For example, use =TRIM(SUBSTITUTE(A1, CHAR(160), " ")).
How do I quickly apply the General format to an entire column?
Click the column letter at the very top of the worksheet to select the entire column. Next, go to the Home tab on the ribbon, click the Number Format dropdown box, and select 'General'. Remember that you will still need to re-enter or refresh any existing formulas for the format change to take effect.




