CleanupIntermediate

Fix a lookup broken by invisible spaces

Two values that look identical and refuse to match. This is the most-reported and least-understood spreadsheet bug there is.

The data

Row numberAB
1Imported codeClean code
2A-101
3 A-102
4A-103
5A-104

Your task

The codes in column A carry stray spaces that break every lookup against them. Put a formula in B2 that returns the cleaned code.

Your formula goes in B2

The checker compares your formula against the accepted answers — it does not run it. The expected result is shown with the solution so you can verify it in your own spreadsheet.

Why this is the right formula

TRIM removes leading and trailing spaces and collapses runs of internal ones to a single space. Before reaching for it, =LEN(A2)-LEN(TRIM(A2)) tells you how many stray characters a cell carries, which is how you prove the problem is whitespace rather than the data. TRIM does not remove non-breaking spaces from web pastes — that needs SUBSTITUTE(A2, CHAR(160), " ") first, which is why the CLEAN-wrapped version is accepted too.

Try next

Use this on your own site

Free to use, share and republish — including commercially. Attribution isn't required, but it's what keeps these free to make, and there's one ready to paste below.

Cite it

Questions

Does this actually run my formula?

No, and it is worth being clear about that. The checker normalises what you type — case, spaces, the semicolon-or-comma separator, dollar-sign anchors — and compares it against every formula that solves the task. The expected result is shown so you can verify it independently in your own spreadsheet.

My formula is different but correct. Will it be marked wrong?

It should not be: each exercise accepts the genuinely different approaches, not one blessed answer. If you find a correct formula that is rejected, the feedback button sends it to us with the page attached.

Do I need an account?

No. There is no signup, no progress tracking and nothing stored — everything happens in your browser.