#VALUE! error in Excel: what it means and how to fix it
#VALUE! means a formula got the wrong kind of value, most often text where it needs a number. The usual causes and fixes, with a practice sheet.
Clean with formulas in a new column, one problem at a time: TRIM for stray spaces, TEXTBEFORE and TEXTAFTER to split and reorder text, VALUE for numbers stored as text, and DATE with LEFT, MID and RIGHT for dates written as plain digits. For a name written “Hart, Lena”, =TRIM(TEXTAFTER(A2,",")&" "&TEXTBEFORE(A2,",")) gives “Lena Hart”; in Excel 2021 or older, FIND with LEFT and MID does the same split. The formulas repeat on next month’s export, which retyping never will.
“We get this customer export every month from an old system. Names come as ‘Surname, First name’ with random spaces, the amounts won’t add up, and the dates aren’t real dates. Clean it so we can use it, in a way that works next month too.”
The interviewer is less interested in any one function than in whether you can see what’s wrong with each column.
TRIM removes spaces at the start and end and squeezes every run of spaces between words into one:
| Row | A | B |
|---|---|---|
| 1 | Raw name | Clean name |
| 2 | Lena Hart | Lena Hart |
Spaces matter more than they look: “Lena Hart “ with a trailing space doesn’t match “Lena Hart” in a lookup, so the lookup question fails with #N/A for no visible reason. =LEN(A2) exposes them: compare it with the number of letters you can see.
One trap to mention: text copied from a web page often has non-breaking spaces, which TRIM doesn’t remove. Replace them with ordinary spaces first, using SUBSTITUTE with CHAR(160).
“Shah, Priya” needs to become “Priya Shah”. TEXTAFTER takes what follows the comma, TEXTBEFORE what precedes it. Join them with a space between and wrap the whole thing in TRIM, which removes the spaces that came along with the comma:
=TRIM(TEXTAFTER(A2,",")&" "&TEXTBEFORE(A2,",")) → Priya ShahWithout the outer TRIM, the result starts with the two spaces that followed the comma, and the cleaned name still won’t match anything:
=LEN(TEXTAFTER(A2,",")&" "&TEXTBEFORE(A2,","))12=LEN(TRIM(TEXTAFTER(A2,",")&" "&TEXTBEFORE(A2,",")))10The lengths tell the story: the untrimmed name is two characters longer than “Priya Shah”. In Excel 2021 or older, which have neither function, find the comma with FIND and cut with LEFT and MID instead (see the FAQ).
Exports often bring numbers in as text: left-aligned, sometimes with a space, and ignored by SUM. Column B here is text, so its total is 0:
=SUM(B2:B4) → 0=VALUE(TRIM(B2)) in a new column turns each one back into a number, and the new column adds up as it should:
| Row | A | B | C |
|---|---|---|---|
| 1 | Invoice | Amount (text) | Amount |
| 2 | INV-301 | 1250 | 1250 |
| 3 | INV-302 | 980 | 980 |
| 4 | INV-303 | 2400 | 2400 |
| 5 | Total | 4630 |
A double minus in front, =--TRIM(B2), does the same. Data › Text to Columns › Finish fixes a whole column in place, if the interviewer asks for a non-formula way.
A date written as 20260315 looks like a date to you and like a number (or text) to Excel. Formatting it as a date doesn’t help: read as a date, 20260315 is far past the last day Excel can show, so the cell just fills with # signs. Take it apart and build a real date:
| Row | A | B |
|---|---|---|
| 1 | Raw date | Date |
| 2 | 20260315 | 15 Mar 2026 |
LEFT takes the year, MID the month, RIGHT the day, and DATE builds a date you can sort, filter and subtract. Once it’s a real date, TEXT can show it any way the report needs.
The other direction this time: the export has “First name Surname” with stray spaces, and the mail merge wants “Surname, First name”. Each name here is one first name and one surname. We check the result, then try a name that’s already clean and one with spaces at both ends.
Your task: In B2, turn the name in A2 into "Surname, First name" for a mail merge: no extra spaces, the surname first, then a comma and a space, then the first name.
Graded live| Row | A | B |
|---|---|---|
| 1 | Raw name | Mail merge name |
| 2 | Lena Hart |
Write the formula in the bar above, then press Check or Enter.
TRIM(A2) cleans the name. In it, TEXTAFTER(…," ") is the surname and TEXTBEFORE(…," ") the first name: join them with ", ".
=TEXTAFTER(TRIM(A2)," ")&", "&TEXTBEFORE(TRIM(A2)," ") Any formula that returns the same result passes.
Walk the columns in order and name the problem before the fix: “Names have extra spaces and are surname-first, so TRIM and a split at the comma. Amounts are text, so VALUE. Dates are eight digits, so DATE with LEFT, MID and RIGHT. All in new columns, so it repeats next month.” That answer shows the habit they’re hiring for. More questions like this one: Excel interview questions.
TRIM removes the ordinary space character. Text copied from a web page often has non-breaking spaces (CHAR(160)), which it leaves alone. Replace them first: =TRIM(SUBSTITUTE(A2,CHAR(160)," ")).
In an interview, formulas: they show your thinking and repeat on new data. Mention Text to Columns, Flash Fill and Power Query as tools for a one-off or a big recurring import.
PROPER capitalises the first letter of each word, UPPER and LOWER change every letter. Nest it around TRIM: =PROPER(TRIM(A2)).
Use FIND to locate the comma, then LEFT for the part before it and MID for the part after: =TRIM(MID(A2,FIND(",",A2)+1,LEN(A2))&" "&LEFT(A2,FIND(",",A2)-1)).
Guides that build on this one.
#VALUE! means a formula got the wrong kind of value, most often text where it needs a number. The usual causes and fixes, with a practice sheet.
#N/A means a lookup didn't find what it was looking for. Here are the six usual causes, how to spot each one on the sheet, and the fix, with a practice sheet.
Invoices due at the end of next month, and the working days a client has to pay: the date task interviewers set, solved with EOMONTH and NETWORKDAYS, plus a sheet that grades yours.
Practise in a live grid that grades what your formula calculates, with a specific hint when it's wrong.
Runs in your browser · Graded on your result · No install