Trim Function Not Working in Excel? Fix It Without Formulas

Have you ever used the TRIM formula, pressed Enter, and nothing happened? If the Trim function isn’t working in Excel, you’re not alone — it’s a common issue that even experienced users encounter.

There are two common reasons why the TRIM function isn’t working in Excel — either you’re dealing with spaces inside numbers, or you’ve got hidden characters that Excel doesn’t recognise as normal spaces.

In this guide, I’ll guide you through simple, beginner-friendly steps to remove these spaces using Excel’s Find and Replace tool.

These fixes are quick, effective, and ideal if you’ve been searching for: ‘trim function not working in Excel’, ‘how to remove spaces in Excel’, or ‘Excel clean up cells without formulas’!

Excel Practice Files

Why Isn’t the TRIM Function Working in Excel?

There may be several reasons why.

How to Remove Spaces from Numbers in Excel Without Using Formulas

There’s no doubt the TRIM function in Excel is an excellent tool for cleaning up messy data. But sometimes, it just doesn’t work the way you expect — especially with numbers.

Take this example:

A screenshot of an Excel spreadsheet showing an example where the TRIM function does not remove all spaces. Cell A4 contains the number '123 456' (with a visible space between 123 and 456), and cell B4 also shows '123 456'. The formula bar displays '=TRIM(A4)' for cell B4. An orange callout points to B4, stating, 'The TRIM function hasn't removed the extra space.

Cell A4 contains what appears to be a number with a space in it. In B4, the TRIM function has been used to remove the space, but the space is still there. Why?

It’s because that extra space has turned the number into text, and TRIM is meant to remove extra spaces between words, leaving just one space. If there’s only one space, TRIM will leave it — that’s exactly how it’s designed to work.

Unfortunately, these unwanted spaces can cause calculation errors, display issues, and misaligned data.

Let’s look at how you can quickly remove spaces between numbers with a simple fix (no formula required) using Find and Replace.

Fix: Remove Spaces in Numbers Using Find and Replace

Use Find and Replace to remove the space entirely — no formulas needed. Just find the space and replace it with nothing.

Follow these steps:

  1. Select the cell or range of cells containing the number with hidden spaces.
  2. Press Ctrl + H to open the Find and Replace dialogue box.
  3. In the ‘Find what’ box, press the spacebar once. This will ask Excel to search your cell or range for single spaces.
  4. Leave the ‘Replace with’ box empty.
  5. Click ‘Replace All’. Excel will replace all spaces with nothing.
  6. Click ‘Close’.
A screenshot of an Excel worksheet and the 'Find and Replace' dialog box. On the left, a cell contains the text 'Number with space' above the number '123 456', which includes a space between 123 and 456. The 'Find and Replace' dialog box is open, with numbered orange labels highlighting key areas: (1) the cell with '123 456', (2) the title bar of the dialog box, (3) the 'Find what:' field, (4) the 'Replace with:' field, (5) the 'Replace All' button, and (6) the 'Find Next' button

Excel will find the unwanted spaces and replace them with nothing, transforming your number back to a number!

Excel spreadsheet with the heading 'Number with space' and a cell containing the number '123456'. An orange callout points to the number, stating 'Space has been removed'.  The image demonstrates that spaces have been removed from the number using the Find and Replace function.

Still have spaces? Your spaces might be hard spaces. Follow the steps below for another method to remove those annoying spaces.

Remove Spaces the Trim Function Misses in Excel

If you’re noticing extra spaces and TRIM isn’t fixing them, you might have non-breaking spaces, also known as hard spaces.

These hidden characters are those that Excel’s TRIM function cannot remove.

TRIM is designed to only remove regular spaces.

Hard spaces and regular spaces are recognised as completely different characters in Excel. Hard spaces have a character code of 160. Regular spaces, a character code of 32.

In the example below, the TRIM function has been used in column B to try to remove the spaces. As you can see, the spaces remain. This suggests that the spaces are most likely hard spaces, not regular spaces.

Excel spreadsheet table with three columns labelled 'Non-breaking spaces,' 'with TRIM,' and 'Formula.' The rows show examples of text with non-breaking spaces in column A, the result after applying the TRIM function in column B, and the formula used in column D. Column B shows that the TRIM formula has not removed the spaces.

Hard spaces often sneak in when you copy data from websites, PDFs, or external systems — and they look just like normal spaces, but Excel treats them differently.

They usually arrive when copying from:

  • Web pages
  • PDFs
  • External data systems like CRMs or accounting software

The good news? You can fix this — and you don’t need to write a single formula.

Let’s look at how to remove hard spaces in Excel using the Find and Replace feature, without needing a formula.

Fix: How to Remove Hard Spaces Excel’s TRIM Function Can’t Detect

Let’s use Find and Replace to remove the space entirely, as we did above. But this time we will need to add an extra step.

Follow these steps:

  1. Select a cell containing the number with hidden spaces.
  2. In the Formula bar, select only one of the troublesome spaces and then press Ctrl + C to copy the space.
Excel spreadsheet showing cell A8 selected, which contains the text 'Sarah Brooke'. The formula bar above also displays 'Sarah Brooke', with one space before the name selected. An orange callout box with an arrow pointing to the space in the formula bar says, 'In the Formula Bar select one of the spaces'.
  1. Select the cell or range of cells you want to clean (e.g. A8 to A11).
  2. Press Ctrl + H to open Find and Replace.
  3. Paste the copied space into the ‘Find what’ box (Ctrl + V).
  4. Press the spacebar once in the ‘Replace with’ box.
  5. Click ‘Replace All’
  6. Click ‘Close’.
Excel spreadsheet with a section titled 'Non-breaking spaces' containing four selected cells: 'Sarah Brooke' (with leading spaces), 'Robert Brown' (with two spaces between the names), 'AB1234', and '1234', both with additional spaces. Next to the spreadsheet, the Find and Replace dialogue box is open. The dialog is labelled with orange numbered callouts: (4) at the top right of the dialog, (5) next to the 'Find what:' field with instructions to paste a hard space here, (6) next to the 'Replace with:' field instructing to press your spacebar once here, (7) pointing at the 'Replace All' button, and (8) pointing at the 'Close' button. The image visually explains how to use Find and Replace in Excel to replace non-breaking spaces with regular spaces.
  • By copying and replacing that hidden space, you’ve told Excel to swap out the non-breaking space (which TRIM can’t detect) with a normal space — the kind TRIM can handle.
  • Once the hard spaces are replaced, TRIM kicks in and does what it’s meant to do — removing any leading, trailing, or extra spaces between text. Your data is now clean, accurate, and ready to be used without causing frustrating errors!
Excel spreadsheet demonstrating how the TRIM function removes extra spaces from text. The table has three columns: 'Non-breaking spaces replaced with regular spaces,' 'with TRIM,' and 'Formula.' In row 8, cell A8 contains 'Sarah Brooke' (with a single space), B8 shows the same, and D8 displays '=TRIM(A8)'. Row 9, cell A9 contains 'Robert Brown' (with two spaces between the first and last name), B9 shows 'Robert Brown' (single space), and D9 displays '=TRIM(A9)'. Row 10, cell A10 has 'AB1234', B10 matches it, and D10 is '=TRIM(A10)'. Row 11, cell A11 has a leading space before '1234', B11 shows just '1234', and D11 is '=TRIM(A11)

Want a formula-based method to remove stubborn hard spaces in Excel?
If you’re regularly pasting data into Excel from PDFs, websites, or external systems, hard spaces can become a recurring issue. Save time by creating a small helper formula using the TRIM with the SUBSTITUTE function. It’s a quick way to clean data automatically without needing to run Find and Replace every time. Check out my tutorial on How to use TRIM with SUBSTITUTE in Excel — perfect for cleaning up large datasets quickly and automatically.

Watch The Excel Video Tutorial

[Watch on YouTube]  /  [Subscribe to our YouTube Channel]

Excel Practice File Download

  • Sign up to unlock the practice file

Conclusion: How to Fix the Trim Function When It’s Not Working in Excel

If you’ve ever wondered why the TRIM function isn’t working in Excel, chances are your cells contain either:

  • A single space in a number (which TRIM is designed to ignore), or
  • Hard spaces (non-breaking spaces) that TRIM can’t detect at all.

The good news? Both issues are easy to fix — and you don’t need complex formulas to get the job done.

Here’s a quick recap:

  • Use Find and Replace to clean up spaces inside numbers. This helps Excel treat the value as a number again, so your calculations work as expected.
  • If TRIM fails to clean up text, it’s likely due to non-breaking spaces. In that case, simply copy the hard space, and replace it with a regular space using Find and Replace — and then let TRIM finish the job.

These quick fixes will help you confidently clean up your data, prevent calculation errors, and ensure your spreadsheet behaves as expected.

Now you’re ready to handle even the sneakiest of spaces like a pro!

TRIM function not working in Excel? Learn how to fix it fast using Find and Replace — no formulas required! Step-by-step guide perfect for beginners and busy professionals.

Was this Blog helpful? Let me know in the comments below.


Sharyn Baines
Sharyn Baines
Certified Microsoft Office Specialist

Was this blog helpful? I’m here to empower your journey with Excel, aiming to make your daily tasks more efficient and boost your potential.

Share your thoughts in the Comments below – your insights not only enrich others, they also help me tailor future content to your needs.

And if you’re looking to take a step further, join our exclusive ‘Insider Group‘. As a member, you’ll receive Weekly Super-Tips, and early access to in-depth tutorials. Sign up Today!

Happy Excel-ling!!

Loved This Tip? Learn Even More in my Self-Paced Excel stage 3 Course

Collection of devices with different parts of the Excel at Work Excel self-paced online courses being displayed with captions.

Improve your workflow with advanced Excel tools like Lookup functions and Pivot Tables. Excel Stage 3 is perfect for streamlining your data analysis and reporting process, saving time!

$347+gst

Recommended

Leave a Reply

Your email address will not be published. Required fields are marked *