Sub topic 3
Fixing #VALUE!: wrong type of value in a formula
This chapter assumes you can enter and edit formulas, use cell references and ranges such as A2 and A2:A10, and tell numbers from text in a cell. You should know basic functions such as SUM and AVERAGE.
What #VALUE! means
Excel returns #VALUE! when a formula contains a value of the wrong type for the operation. The formula is written correctly, but one of its inputs cannot be used the way the formula needs.
The most common case is arithmetic on text. The operators +, -, *, / and ^ need numbers. If a referenced cell holds text that Excel cannot read as a number, the formula fails.
| Formula | Cell contents | Result |
|---|---|---|
| `=A2+B2` | A2 is 10, B2 is 5 | 15 |
| `=A2+B2` | A2 is 10, B2 is "n/a" | #VALUE! |
| `=A2+B2` | A2 is 10, B2 is "5" (text that looks like a number) | 15, because Excel converts it in arithmetic |
| `=A2+B2` | A2 is 10, B2 contains only a space | #VALUE! |
The third row surprises many learners. Excel does convert text such as "5" during arithmetic. It fails when the text cannot be read as a number, for example "n/a", "N/A " with trailing characters, or a cell with only spaces. A cell that looks empty but holds a space or an empty string returned by another formula (="") is a frequent culprit.
Where #VALUE! comes from
Most #VALUE! errors fall into a small number of causes.
- Text in arithmetic. A cell holds a word, a dash, "n/a" or a stray space, and the formula adds, subtracts, multiplies or divides it.
- Hidden characters. Imported data often has leading or trailing spaces, or non-breaking spaces (character 160) that look like normal spaces but are not removed by TRIM.
- Wrong argument type. A function expects a number but receives text, or expects a single value but receives a range. For example,
=LEFT(A2:A5,2)in an older version of Excel returns #VALUE! because LEFT needs one cell. - Mismatched array sizes. Functions that combine arrays, such as SUMPRODUCT with ranges of different lengths, return #VALUE!.
- Dates stored as text. A date such as "2026-13-45" or a date typed in a format your regional settings do not recognize is text, so date arithmetic fails.
- Wrong separators or locale. A number such as "1,5" is a decimal in some regions and text in others.
- Functions with invalid arguments. For example,
=DATEDIFwith a start date later than the end date, or a function given a negative count where it needs a positive one.
Finding the bad input
Work from the formula backward. A reliable routine is:
- Click the cell with #VALUE! and read the formula in the formula bar.
- List every cell or range the formula refers to.
- For each referenced cell, check whether it holds a real number. Numbers align to the right by default and text to the left, though formatting can change this.
- Use a test formula in a spare cell to confirm.
=ISNUMBER(B2)returns TRUE for a real number and FALSE for text.=ISTEXT(B2)does the opposite.=LEN(B2)shows how many characters the cell holds, which exposes hidden spaces.
If B2 looks like 5 but =LEN(B2) returns 2, the cell holds an extra character.
The Evaluate Formula tool (Formulas tab) steps through a formula one part at a time, so you can see which part first produces #VALUE!. Later chapters cover it in detail.
Fix 1: use SUM instead of the plus operator
The + operator fails when any operand is unreadable text. The SUM function ignores text in cell references and adds only the numbers.
=SUM(A2,B2)If A2 is 10 and B2 is "n/a", this returns 10, not an error. Compare this with =A2+B2, which returns #VALUE!.
Be careful before you switch. SUM skipping the text means the result is quietly incomplete. If "n/a" means a value is missing, a total that leaves it out may be wrong in a way nobody notices. Use SUM when ignoring text is the correct business rule, not simply to make the error disappear.
SUM ignores text only in references. If you type text directly as an argument, such as =SUM(10,"abc"), Excel returns #VALUE! because it tries to convert the typed argument. Text that looks like a number typed directly, such as =SUM(10,"5"), is converted and counted.
Fix 2: clean and convert the data
When the cells are meant to be numbers but arrived as text, convert them. The pairing of TRIM and VALUE handles the common case.
=VALUE(TRIM(A2))TRIM removes leading and trailing spaces, and reduces repeated spaces inside the text to one. VALUE then converts text that looks like a number into a real number.
For non-breaking spaces, which TRIM does not remove, replace character 160 first.
=VALUE(TRIM(SUBSTITUTE(A2,CHAR(160)," ")))SUBSTITUTE swaps each non-breaking space for a normal space. TRIM then cleans up the result and VALUE converts it.
You can apply this in a helper column, then copy the column and use Paste Special > Values over the original data. The next chapter section on hidden spaces covers the related detection techniques in more depth.
VALUE itself returns #VALUE! if the text cannot be read as a number. =VALUE("abc") fails. If a column mixes real numbers and words, you will need to decide what to do with the words, as described below.
Fix 3: handle blanks and placeholders
Cells holding "n/a", "-" or an empty string are placeholders. You have three practical options.
- Replace them with real blanks. Blank cells are treated as zero in arithmetic, so
=A2+B2works. Use Find and Replace, or clear the cells. - Test before calculating. Check the cell type in the formula.
- Use a function that tolerates text. SUM, AVERAGE, MIN, MAX and COUNT skip text in references.
The test-first approach looks like this:
=IF(AND(ISNUMBER(A2),ISNUMBER(B2)),A2+B2,"")The formula returns the sum only when both cells hold numbers, and an empty string otherwise. Note that returning "" can cause #VALUE! in any later formula that uses this cell in arithmetic, so choose the fallback with the downstream formulas in mind. A fallback of 0 keeps later arithmetic working but can distort totals and averages.
Fix 4: match argument types
Some #VALUE! errors have nothing to do with text in cells. They come from giving a function the wrong shape of input.
- Pass a single cell where a function expects a single value.
=LEFT(A2,3)works. - Make ranges the same size in functions that combine arrays.
=SUMPRODUCT(A2:A10,B2:B10)works.=SUMPRODUCT(A2:A10,B2:B9)returns #VALUE!. - Check that dates are real dates. Test with
=ISNUMBER(A2). A real date is a number underneath, so it returns TRUE. If it returns FALSE, the date is text and needs converting with DATEVALUE or by re-entering it.
=DATEVALUE("2026-11-27")This returns a serial number that you can format as a date. DATEVALUE depends on your regional settings, so a text form your system does not recognize returns #VALUE!.
A worked example
A sales sheet has quantities in column A and unit prices in column B. Some prices were imported as text with trailing spaces, and one says "n/a". The total in C2 is =A2*B2.
| Row | A (quantity) | B (price) | `=A2*B2` result |
|---|---|---|---|
| 2 | 4 | 2.50 | 10 |
| 3 | 3 | "2.50 " (trailing space) | 7.5, because the trailing space is ignored when Excel converts the text |
| 4 | 5 | "n/a" | #VALUE! |
| 5 | 2 | non-breaking space after the digits | #VALUE! |
Row 3 happens to work, because Excel's arithmetic conversion tolerates ordinary spaces around a number. Row 5 fails, because a non-breaking space is not treated as a space.
Checking =LEN(B5) and =ISNUMBER(B5) confirms the cause. The repair depends on the meaning of each row. For row 5, clean the data with the SUBSTITUTE formula above. For row 4, the price is unknown, so the correct result is a visible gap, not a made-up zero:
=IF(ISNUMBER(B4),A4*B4,"Price missing")This keeps the problem visible, which is a better outcome than hiding the error.
Common mistakes
- Wrapping the formula in IFERROR straight away. This hides the error but leaves the bad data in place. Fix the cause first, and mask only errors you expect.
- Trusting how a cell looks. A cell that shows 5 can be text. Test with ISNUMBER.
- Assuming TRIM removes every space. It does not remove character 160.
- Using
""as a fallback and then doing arithmetic on it. The empty string is text, so the next formula returns #VALUE!. - Converting in place without a backup. Clean data in a helper column first, check the result, then paste values.
Exercise
Cell A2 holds the number 40, and B2 holds the text "n/a". What does =A2+B2 return, what does =SUM(A2,B2) return, and which one should you use if "n/a" means the value is unknown and the total must not look complete?
Show answer
=A2+B2 returns #VALUE! because "n/a" cannot be read as a number. =SUM(A2,B2) returns 40 because SUM ignores text in cell references. Use a formula that keeps the gap visible, such as =IF(AND(ISNUMBER(A2),ISNUMBER(B2)),A2+B2,"Value missing"), because SUM would return 40 and make the total look complete.
Exercise
A cell shows 25 but =A2*2 returns #VALUE!, and =LEN(A2) returns 3. TRIM does not change the result. What is the likely cause, and what formula fixes it?
Show answer
The cell holds a hidden extra character, most likely a non-breaking space (character 160), which TRIM does not remove. Use =VALUE(TRIM(SUBSTITUTE(A2,CHAR(160)," "))) to replace it with a normal space, trim, and convert to a number.