DEV Community

Robert Breen
Robert Breen

Posted on Originally published at ynteractive.com

Excel #N/A, #VALUE!, #DIV/0! and #REF!: Fix the Cause, Not the Symptom (and Why IFNA Beats IFERROR)

Excel errors tend to show up the day before invoices go out. The quick fix you find online is to wrap everything in IFERROR. The sheet looks clean, and the total is wrong.

This post walks through a made-up October billing workbook for Ridgeway Architects with five errors in it, the actual cause of each, and a safer lookup formula. The diagnosis was done with ChatGPT from a plain-text note describing every cell and formula, but the fixes are plain Excel, and you should check every one in your own workbook.

The workbook

Three sheets: Rates (project code and hourly rate), Timesheet (project code, hours, rate lookup, amount) and Summary. Five cells are broken:

Cell Error
Timesheet D3 #N/A
Timesheet E4 #VALUE!
Timesheet D5 #N/A
Timesheet E10 #DIV/0!
Summary B2 #REF!

The prompt that gets causes, not cover-ups

Give the AI the real cells and formulas (a note or a screenshot), use a Temporary Chat for business data, and say explicitly that you do not want errors hidden:

The attached note describes my billing workbook and the errors in it. I'm an office manager, not an Excel expert. For each error (#N/A in D3, #VALUE! in E4, #N/A in D5, #DIV/0! in E10, #REF! on the Summary sheet), tell me in plain words what it means, what caused it in this sheet, and the right fix. Fix the cause, don't just hide the error. Then tell me in what order to fix them.
Enter fullscreen mode Exit fullscreen mode

Without "fix the cause, don't just hide the error", the easy answer is IFERROR everywhere.

Each error and its real cause

#N/A in D3: a trailing space. The lookup is looking for the project code in B3, but B3 has a space after the code, so it matches nothing in Rates. Fix: remove the space (and make the formula immune to it, below).

#VALUE! in E4: text where a number should be. C4 says 7.5 hrs. Excel cannot multiply words. Fix: type 7.5.

#N/A in D5: a genuinely missing rate. Project RW-105 is not on the Rates sheet. The right fix is to add the real rate. The answer said, in so many words, do not guess the rate.

#DIV/0! in E10: dividing by zero or an empty cell. Decide what that cell should show when there is nothing to divide, such as "No activity", rather than forcing a zero.

#REF! on Summary B2: a deleted column. The formula pointed at a cell that no longer exists. Fix: point it at the right cell again, here =Timesheet!E8.

The bonus catch

Nobody asked about it, but E10 is labeled Share billed to RW-106 while its formula works out an average rate, not a share. A label and a formula that disagree are a bug even when no error shows. Ask whoever built the sheet which one they meant.

A total you can defend

Second prompt:

Good. Now two things. 1) Once those are fixed, what should Total billed in E8 be? Show the arithmetic line by line so I can check it, and tell me which row you cannot total and why. 2) Give me a safer version of the D2 formula I can copy down so a trailing space never breaks it again and a missing project code shows "Add rate" instead of an error. Explain what each part does.
Enter fullscreen mode Exit fullscreen mode

The arithmetic came back line by line, with RW-105 left out because its rate is unknown:

1,072.50 + 1,120.00 + 1,387.50 + 750.00 = 4,330.00
Enter fullscreen mode Exit fullscreen mode

Check it yourself. One row: 6.5 hours x $165 = $1,072.50. The hours add to 27 without row 5, 31 with it. The answer also used $160 and $150 as example rates in places: those are illustrations, not rates. Do not bill from them.

The safer lookup

=IFNA(VLOOKUP(TRIM(B2),Rates!A:B,2,FALSE),"Add rate")
Enter fullscreen mode Exit fullscreen mode
  • TRIM(B2) strips stray spaces, so B3 finds its rate.
  • VLOOKUP(..., Rates!A:B, 2, FALSE) is an exact-match lookup of the code in column A, returning the rate in column B.
  • IFNA(..., "Add rate") replaces only the not found error.

Why IFNA and not IFERROR

IFERROR hides every error, including a #REF! from a deleted range or a #VALUE! from bad input. IFNA handles exactly one case, a missing match, and lets every other problem stay visible. That is what you want in a billing sheet.

After the change, E5 still shows #VALUE!, because it cannot multiply 4 hours by the words "Add rate". That is a warning, not a bug. Do not type a zero just to make E8 add up; get the real rate before invoicing.

Order of operations

  1. Fix the data: remove the trailing space, replace 7.5 hrs with 7.5.
  2. Repoint Summary B2 to =Timesheet!E8.
  3. Replace the D2 lookup with the TRIM + IFNA version and copy it down.
  4. Decide what E10 should show, and whether it should be a share or an average.
  5. Get RW-105's real rate. Until then, E5 and the total stay visibly incomplete.

Checklist

  • [ ] Gave the AI the real cells and formulas, not a vague description
  • [ ] Asked it to fix causes, not hide errors
  • [ ] Checked the subtotal by hand ($4,330.00 for the four known rows)
  • [ ] Treated example rates as examples, not billable numbers
  • [ ] Used IFNA for the lookup, not a blanket IFERROR
  • [ ] Checked that labels match what the formulas compute
  • [ ] Pasted the formulas into your own copy and confirmed D3 shows 140 and D5 shows Add rate

One honest note from the lesson: the formulas were not pasted into a real Excel workbook for it. Rebuild the sheets from the downloadable note, paste them in, and check the results yourself.

The full walkthrough, with the billing note to download and a 19-step practice copy of ChatGPT, is here: ChatGPT: Fix #N/A, #VALUE!, #DIV/0! and #REF! Errors in Excel.

Top comments (0)