How to Fix #REF! Error in Excel (Step-by-Step)
A finance analyst I know — sharp guy, ten years in — deleted a column from a quarterly report on a Tuesday afternoon and didn't notice the cascade until his director asked why half the dashboard showed nothing but #REF!. It was 4:47 PM. The presentation was at 9:00 AM the next day. Three hours of manual checking later, he had traced it back to a single deleted column that six other formulas depended on.
That's the thing about a REF error in Excel: it rarely stays in one cell. This guide walks you through finding every broken reference before you touch anything, fixing the actual cause, and understanding what not to do, including the mistake that makes the damage permanent.
|
| One deleted column can trigger #REF! errors across every formula that depended on it — including formulas on other sheets. |
What You'll Fix (and the One Thing to Check Before You Touch Any REF Error in Excel)
A #REF! error means Excel's formula is pointing at a cell reference that no longer exists or no longer makes sense. The formula isn't broken in its logic — it's broken in its geography. The cell it was counting on has been deleted, moved, or made unreachable.
By the end of this guide, you'll be able to locate every invalid cell reference in a workbook, fix the three most common causes, and know when error handling actually helps versus when it's hiding a real problem.
Before you change anything: save a backup of the workbook right now. If you've already deleted a worksheet tab and you're seeing formula errors everywhere, the only recovery path is closing the file and reopening the last saved version. You cannot undo a tab deletion in Microsoft Excel. That's not a footnote — that's the whole ballgame.
Fixing broken cell references in Excel starts with protecting what you still have.
Step 1: Find Every REF Error in Excel Before You Fix a Single One
Once you've saved your backup, resist the urge to start clicking on cells. The smarter move is to find every instance of the formula error at once, across every sheet, before you fix anything. Patching one cell while three others are still broken is how you end up chasing errors for an hour.
If you're newer to Excel's error types, the Common Excel Errors and Troubleshooting guide gives useful context before you go deeper here.
Use Find & Replace to Locate All #REF! Errors at Once
- Press Ctrl + H to open Find & Replace, then switch to the Find tab (or use Ctrl + F).
- Type #REF! in the search box exactly as shown.
- Under Within, change "Sheet" to Workbook — this catches broken references hiding on sheets you're not currently viewing.
- Click Find All. Excel lists every matching cell at the bottom of the dialog.
Write down or screenshot the full list before closing the dialog. This is your repair checklist.
When one cell returns #REF!, every formula downstream that references it also returns #REF!. The error propagates — which is why you'll sometimes see errors in cells that look completely unrelated to whatever you just deleted or changed. The visible errors are just the top layer.
Step 2: Fix the REF Error in Excel Based on What Actually Caused It
With your full list from Step 1, now you can actually fix things. The correction depends entirely on the root cause, and there are three distinct scenarios worth treating separately.
When You Deleted a Row, Column, or Cell the Formula Depended On
This is the most common cause. You deleted something, and a formula that was pointing at it now has nowhere to point. Deleting columns feels harmless until it isn't.
If you caught it immediately and haven't made further changes, Ctrl + Z will undo the deletion and the errors disappear. If you've made other edits since, your options narrow. For a deleted worksheet tab specifically, there is no undo. Close without saving and reopen the last saved version. That's your only clean path back.
For deleted cells in the middle of a sheet, click the cell showing the error, look at the formula bar, and find the #REF! text sitting where the cell address used to be. Replace it with the correct reference — either retype the address or click the cell you actually want.
When a Copy-Paste Pushed a Reference Out of Range
Relative references shift when you copy a formula. Paste it too far down or too far right and the reference can slide off the edge of the data — or off the sheet entirely. This is common with VLOOKUP, where the column index number can also exceed the width of the lookup range, producing a #REF! error that looks structural but is really just a number being too large.
For the copy-paste version, correct the shifted reference manually or use absolute references (add $ signs before the column letter and row number) before copying if the reference isn't supposed to move. For VLOOKUP column-index issues, consider switching to XLOOKUP. It references a return column directly rather than counting from an index number, which eliminates this particular failure mode entirely.
When the Error Comes from an External Workbook Not Being Open
This one surprises people who work in shared OneDrive or Microsoft 365 environments. If your formula references another workbook and that workbook isn't currently open, Excel can return a #REF! error — or show stale data — depending on the formula type. Opening both workbooks at the same time typically resolves it, because Excel can re-evaluate the live reference. If the source file has been moved, renamed, or deleted from the shared drive, update the file path through Data > Edit Links.
Step 3: Use IFERROR to Stop a REF Error From Breaking Your Whole Spreadsheet
Once you've fixed the broken references from Step 2, there are cases where adding error handling makes sense — particularly for formulas that reference external files or dynamic ranges that might occasionally be empty.
The syntax is straightforward:
=IFERROR(your_formula, "") returns a blank instead of an error. You can also return a zero or a custom message.
Here's an honest take on the IFERROR function: it's a finishing tool, not a debugging tool. Wrapping everything in IFERROR the moment you see a formula error means your spreadsheet silently returns blanks where it should be warning you. A #REF! error is Excel telling you something broke. IFERROR tells Excel to stay quiet about it. Get the formula working correctly first — understand the cause, fix it — then add IFERROR if the formula genuinely needs a graceful fallback. Not before.
Common Mistakes When You Fix a REF Error in Excel (Including the One That Makes It Permanent)
The most damaging mistake is deleting a sheet tab, noticing the #REF! errors, and continuing to work — saving the file, making more edits — before trying to recover. Once you save over the last good version, the data loss is permanent. The correct response to seeing errors after a tab deletion is to stop immediately, close without saving, and reopen.
The second mistake is wrapping formulas in IFERROR without fixing the underlying invalid cell reference. This one is particularly dangerous because the workbook looks fine — no red cells, no warnings — but the data is wrong, and you won't know it until someone questions a number that doesn't add up.
The third mistake is treating a VLOOKUP column-index error as the same problem as a true deleted-cell reference error. They look identical but have different fixes. A VLOOKUP returning #REF! because the col_index_num is larger than the table width is a formula logic error — fix the number, or replace VLOOKUP with XLOOKUP, which references the return range directly and sidesteps this entirely. The Excel for Beginners guide covers lookup function basics if you want to understand how VLOOKUP errors differ from other formula errors.
If you take one thing from this article: understand what #REF! is telling you before you hide it. The error is useful information. Don't silence it until you've actually fixed what broke.
Frequently Asked Questions
Can you undo a deleted sheet in Excel?
No — deleting a worksheet tab in Excel cannot be undone with Ctrl + Z. If you've deleted a sheet and are now seeing #REF! errors, your only recovery option is to close the file without saving and reopen the last saved version. This is why saving a backup before making structural changes is non-negotiable.
Why does Excel show REF when I delete a row?
When you delete a row (or column, or cell), any formula that was directly referencing cells in that row loses its target. Excel replaces the now-invalid address with #REF! in the formula bar, and the cell displays the error. Every formula that references that cell downstream will also show #REF!, which is why one deletion can trigger errors across an entire workbook.
Does XLOOKUP get REF errors less often than VLOOKUP?
Yes, in one specific way. VLOOKUP uses a column index number to identify the return column, and if that number exceeds the width of the lookup range, you get a #REF! error. XLOOKUP references the return range directly, so there's no index number to go out of bounds. It doesn't eliminate all #REF! risk — deleted references can still break XLOOKUP — but it removes that particular failure point.
Join the conversation