Excel #REF! error: invalid cell reference
Hi, it's BlueByte. A #REF! means a formula is pointing at a cell that no longer exists — the reference itself was destroyed, not just the value. If it just happened, one Ctrl+Z brings it back. Let's undo it if we can, and rebuild the formula so a future deletion can't do this again.
What #REF! means
A cell shows #REF! where a value should be:
=SUM(B2,#REF!,D2)The formula refers to a cell reference that is no longer valid — the reference itself was destroyed, not just the value. Excel writes #REF! in place of the address it can no longer resolve, and because it bakes that into the formula, the original address is gone once you save.
What destroys the reference
#REF! appears when the cells a formula pointed at were deleted or pasted over:
- You deleted rows or columns the formula depended on, and Excel had nothing sensible to shift the reference to.
- You cut and pasted cells over the ones a formula referenced.
- A VLOOKUP (or INDEX) asks for a column index larger than its table range.
- An INDIRECT points at a workbook that is closed.
- You deleted a worksheet that a 3‑D reference or another sheet's formula relied on.
Find where the #REF! sits
Open the formula and see where the #REF! sits, then find every occurrence — Home → Find & Select → Find, and search for #REF!. If it appeared the instant you deleted something, that deletion is the cause. If it is inside a VLOOKUP, check the column index against the range width; if inside INDIRECT, check whether the referenced file is open; if a whole sheet's formulas broke at once, a deleted sheet is likely.
Undo it, then make it resilient
-
If it just happened, undo the deletion immediately with Ctrl+Z. That restores the deleted cells and the reference repairs itself.
-
If undo is not an option, replace the
#REF!part of the formula with the correct cell address. -
Make it resilient — reference a range instead of listing single cells, so deleting a column inside it adjusts the formula automatically:
=SUM(B2:D2)Deleting column C now leaves =SUM(B2:C2), not a #REF!.
- For VLOOKUP, keep the column index within the table range —
=VLOOKUP(A8,A2:E5,5,FALSE)is valid (5 columns); asking for column 6 returns#REF!.
A real case: a tidy-up gone wrong
You delete an unused column B to tidy a sheet, and a summary cell that read =C2*B2 now shows =C2*#REF!. It just happened, so you press Ctrl+Z — column B comes back and the formula reads =C2*B2 again. Realizing the summary should not have depended on a column you might delete, you rewrite it to reference the intended input by a named range instead, so a future tidy-up cannot break it. Find & Select for #REF! confirms no other formula was affected.
Confirm the reference holds
The cell should show its computed value again, and Find should report no more #REF! in the sheet. Delete a test column inside your new range reference and confirm the formula adjusts instead of breaking — that proves the resilient version works.
Keep it from recurring
Use range references rather than naming individual cells, so Excel adjusts them when rows or columns are deleted. When you must delete data a formula uses, update or remove the formula in the same step rather than leaving a dangling reference.
How this differs from #NAME? and #VALUE!
#REF! means the reference is gone. #NAME? means Excel does not recognize a name or function (a typo in the function name), and #VALUE! means an argument is the wrong type. Only #REF! is about a reference that used to exist and no longer does — so when you see it, look at what you just deleted.
Related questions
Can I get the original reference back?
Only by undoing the deletion (Ctrl+Z) while it is still in the undo history. Once #REF! is baked in and saved, Excel no longer knows what the reference used to be — you have to re-enter it.
How do I stop it from happening again?
Use range references (=SUM(B2:D2)) instead of naming individual cells. Excel adjusts a range when you delete inside it, so the formula survives.
My INDIRECT shows #REF! but nothing was deleted.
INDIRECT to a closed workbook returns #REF! — the source file must be open for it to resolve. Open the referenced workbook, or avoid INDIRECT across files.
VLOOKUP returns #REF! but the data is there.
The column index number is larger than the number of columns in the table range. Reduce the index or widen the range so the requested column exists.
Every formula on one sheet broke at once.
You likely deleted a worksheet that those formulas referenced. Undo if you can; otherwise recreate the sheet or repoint the formulas at the correct source.
References
Haneul Seo
Infrastructure engineer · 10+ years running Linux fleets
More in this category
Gmail rejects your mail with 550-5.7.26: unauthenticated email is not accepted due to the domain's DMARC policy
Gmail enforced the DMARC policy your own domain publishes: the message failed both SPF and DKIM alignment against the header From: domain, so a p=quarantine or p=reject policy turned it into a hard bounce. The Authentication-Results header names the failing check, and three dig queries against your SPF, DMARC and DKIM records name the cause. A near-identical bounce about authenticating with SPF or DKIM is a different problem — Gmail's baseline sender requirements, not your policy.
Microsoft Entra ID: AADSTS50011, the redirect URI specified in the request does not match the redirect URIs configured for the application
Sign-in completes and then Entra ID refuses the last hop, because the redirect_uri your app sent is not a byte-for-byte match for any URI registered on the app. The match is case-sensitive, counts the trailing slash, requires https outside localhost, and treats the port as significant everywhere except localhost. It also splits by platform: web, spa and publicClient are three separate lists, and URIs added to the service principal instead of the application object can disappear. Read the URI and the app ID out of the error, compare them with az ad app show, add the exact string with az ad app update or a Graph PATCH, then wait three to five minutes.
Exchange Online: 535 5.7.139 Authentication unsuccessful, SmtpClientAuthentication is disabled
A scanner, script or app that sends through smtp.office365.com gets 535 5.7.139 because the SMTP AUTH protocol is switched off for the tenant, for that mailbox, or by an authentication policy or security defaults that block Basic authentication. Read the wording (Tenant, Mailbox, or 'did not meet the criteria'), confirm with Get-TransportConfig, Get-CASMailbox and Get-AuthenticationPolicy, then open SMTP AUTH on the one mailbox that needs it rather than tenant-wide. Treat Basic SMTP AUTH as a bridge: Microsoft disables it by default for existing tenants at the end of December 2026, so move the sender to OAuth, High Volume Email or a relay connector.
Zoom: "Unable to connect" error code 5003 — the desktop app can't reach Zoom while the browser can
Error 5003 is the Zoom desktop app failing to complete its connection to Zoom's servers while the web client on the same machine joins fine. The app needs more than a browser does: Zoom's firewall article lists TCP 443/8801/8802 and UDP 3478/3479/8801–8810 for meetings, a set of CA hosts for certificate validation, and it asks that zoom.us and *.zoom.us be exempted from proxy or SSL inspection. A port test, a curl issuer check, and the app's built-in Network Connectivity Tool (Ctrl+Alt+Shift+D / Cmd+Option+Shift+D) show which of those is cut; fix that layer, and reinstall only when a single machine fails while its neighbours join.
Slack: "Slack cannot connect" and the grey "Last updated…" banner behind a corporate proxy
Slack loads channels over ordinary HTTPS but delivers new messages over a persistent WebSocket on port 443 to the three wss-*.slack.com hosts Slack names (primary, backup, mobile). When a proxy or firewall passes the HTTP side and blocks the upgrade — most often because SSL decryption is on for the wss hosts, or the allowlist stops at slack.com — the app shows the grey "Last updated…" banner or "Slack cannot connect." while the browser seems fine. Two curl probes from the affected machine show which layer is blocked; exempt the three wss hosts from decryption, allow every domain on my.slack.com/help/urls, and confirm with my.slack.com/help/test.
Word: "The document is locked for editing by another user"
Word found a lock — an owner file — for the document and assumed someone else has it open, so it offers only a read-only copy. Usually no one does: a crash left the lock behind, or a hidden Word process is still holding the file. Confirm which, close every Word instance, delete the stale ~$ owner file, and the document opens for editing again.