How to correct a #REF! error (2024)

Skip to main content

Microsoft

Support

Support

Sign in

Sign in with Microsoft

Sign in or create an account.

Hello,

Select a different account.

You have multiple accounts

Choose the account you want to sign in with.

Formulas and functions

Errors

Errors

How to correct a #REF! error

Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel 2016 Excel for iPad Excel for iPhone Excel for Android tablets Excel for Android phones Excel for Windows Phone 10 Excel Mobile More...Less

The #REF! error shows when a formula refers to a cell that’s not valid. This happens most often when cells that were referenced by formulas get deleted, or pasted over.

The following example uses the formula =SUM(B2,C2,D2) in column E.

How to correct a #REF! error (2)

If you were to delete column B, C or D it would cause a #REF! error. In this case we'll delete column C (2007 Sales), and the formula now reads =SUM(B2,#REF!,C2). When you use explicit cell references like this (where you reference each cell individually, separated by a comma) and delete a referenced row or column, Excel can’t resolve it, so it returns the #REF! error. This is the primary reason why using explicit cell references in functions is not recommended.

How to correct a #REF! error (3)

Solution

  • If you accidentally deleted rows or columns, you can immediately select the Undo button on the Quick Access Toolbar (or press CTRL+Z) to restore them.

  • Adjust the formula so that it uses a range reference instead of individual cells, like =SUM(B2:D2). Now you could delete any column within the sum range and Excel will automatically adjust the formula. You could also use =SUM(B2:B5) for a sum of rows.

In the following example, =VLOOKUP(A8,A2:D5,5,FALSE) will return a #REF! error because it’s looking for a value to return from column 5, but the reference range is A:D, which is only 4 columns.

How to correct a #REF! error (4)

Solution

Adjust the range to be larger or reduce the column lookup value to match the reference range. =VLOOKUP(A8,A2:E5,5,FALSE) would be a valid reference range, as would =VLOOKUP(A8,A2:D5,4,FALSE).

In this example, the formula =INDEX(B2:E5,5,5) returns a #REF! error because the INDEX range is 4 rows by 4 columns, but the formula is asking to return what’s in the 5th row and 5th column.

How to correct a #REF! error (5)

Solution

Adjust the row or column references so they're inside the INDEX lookup range. =INDEX(B2:E5,4,4) would return a valid result.

In the following example, an INDIRECT function is attempting to reference a workbook that’s closed, causing a #REF! error.

How to correct a #REF! error (6)

Solution

Open the referenced workbook. You'll encounter the same error if you reference a closed workbook with a dynamic array function.

Structured references to table and column names in linked workbooks aren’t supported.

Calculated references to linked workbooks aren’t supported.

Moving or deleting cells caused an invalid cell reference, or function is returning reference error.

If you have used an Object Linking and Embedding (OLE) link that is returning a #REF! error, then start the program that the link is calling.

Note: OLE is a technology that you can use to share information between programs.

If you have used a Dynamic Data Exchange (DDE) topic that is returning a #REF! error, first check to make sure you’re referencing the correct topic. If you're still receiving a #REF! error, check your Trust Center Settings for external content as outlined in Block or unblock external content in Microsoft 365 documents.

Note: Dynamic Data Exchange (DDE)is an established protocol for exchanging data between Microsoft Windows-based programs.

Macro Issues

If a macro enters a function on the worksheet that refers to a cell above the function, and the cell that contains the function is in row 1, the function will return #REF! because there are no cells above row 1. Check the function to see if an argument refers to a cell or range of cells that is not valid. This may require editing the macro in the Visual Basic Editor (VBE) to take that situation into account.

Need more help?

You can always ask an expert in the Excel Tech Communityor get support inCommunities.

See Also

Overview of formulas in Excel

How to avoid broken formulas

Detect errors in formulas

Excel functions (alphabetical)

Excel functions (by category)

Need more help?

Want more options?

Discover Community

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

How to correct a #REF! error (7)

Microsoft 365 subscription benefits

How to correct a #REF! error (8)

Microsoft 365 training

How to correct a #REF! error (9)

Microsoft security

How to correct a #REF! error (10)

Accessibility center

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

How to correct a #REF! error (11)

Ask the Microsoft Community

How to correct a #REF! error (12)

Microsoft Tech Community

Thank you for your feedback!

×

How to correct a #REF! error (2024)

FAQs

How to correct a #REF! error? ›

How to Fix #REF Excel Errors. The best method is to press Ctrl + F (known as the find function) and then select the tab that says Replace. Type “#REF!” in the Find field and leave the Replace field empty, then press Replace All. This will remove any #REF Excel errors from formulas and thus fix the problem.

How to fix a #ref error? ›

If you want to remove the #REF! references from the formulas, you could select the Replace tab and leave the Replace with field empty. Click Replace All. This replaces all #REF!

Why do I get #ref when I copy and paste? ›

Summary. The #REF! error occurs when a reference is invalid. In many cases, this is because sheets, rows, or columns have been removed, or because a formula with relative references has been copied to a new location where references are invalid.

What should be done to resolve a name error? ›

Solution: Correct the typo in the syntax and retry the formula. Tip: Instead of manually entering defined names in formulas, you can have Excel do it automatically for you. Go to Formulas > Defined Names > select Use in Formula, and then select the defined name you want to add. Excel adds the name to the formula.

What does ref error mean in Google Sheets? ›

#REF! Error. This type of error occurs when you reference an invalid cell. For example, suppose you referenced a cell range of B2:F2 in your SUM function, but you deleted your original column C, making your SUM function appear in column F. In this case, Google Sheets will throw a #REF!

What does reference error mean? ›

The ReferenceError object represents an error when a variable that doesn't exist (or hasn't yet been initialized) in the current scope is referenced. ReferenceError is a serializable object, so it can be cloned with structuredClone() or copied between Workers using postMessage() .

What is the if error on a refrigerator? ›

The IF or F1 error code indicates that the refrigerator has detected a problem with the refrigerator's ice maker fan.

How to correct a name error? ›

Simply press Ctrl + H on your keyboard to open the Find and Replace dialog box. Then, type #NAME? in the Find what box, leave the Replace with box blank and click Replace All. This will remove all instances of the #NAME error in your worksheet. That's how to find and correct the #NAME error in Excel.

How do you handle name errors? ›

In Python, the NameError is handled by mentioning it in the except block. If only the NameError is triggered in the try block in the following sample code, an error message will occur. You can practice by yourself with the help of online python compiler.

How do I debug a name error? ›

In the case of a NameError, you can check if you typed the variable or function name correctly, if it should be in quotes, or if you should have defined it somewhere prior to the line.

How do I get rid of #ref in sheets? ›

How to solve #REF! When you have lost the reference of a particular cell
  1. Deleting an essential cell.
  2. Deleting an essential row/column.
  3. Deleting an essential sheet.
  4. Copying and pasting your formula to another cell/sheet.

How to fix reference isn't valid in Excel? ›

The solution to this issue is always to save a copy of the file to your local drive. Pro Tip: If you are using an Excel file that is in Read-only mode to create a Pivot Table, make sure to save that Excel file to your local disk.

How do I remove an error in a Google sheet? ›

Sometimes you might see an error message and the error will resolve itself. Wait for five minutes and reload the page. If you have a poor internet connection, you can try moving to a location where the internet is more reliable.

Why am I getting a ref error in index match? ›

A #REF! error can occur when a MATCH is found, but the INDEX array is not big enough to include that row. For example, if there are 10 rows in the MATCH lookup_array, but only 5 rows in the INDEX array, a #REF! error will be returned for any MATCH in the 6th to 10th position.

How do I remove #ref in Google Sheets? ›

Use the IFERROR function
  1. Double click the cell containing #REF!
  2. Rewrite your formula using the IFERROR. You can choose to replace your errors with a blank cell or a zero value, or you can opt to add a message to alert other users of the issue. For example, in my formula, I will use the following:

How do you prevent ref errors? ›

To prevent the #REF error in Excel:
  1. Don't delete the structural part of any row, column, or sheet unless abundant.
  2. Use in-built functions of Excel and not operators.
  3. Turn your references into absolute references before you copy/paste formulas.
Feb 12, 2024

How to hide #ref in Excel? ›

Hide error indicators in cells

You can prevent these indicators from being displayed by using the following procedure. On the File tab, select Options and choose Formulas. Under Error Checking, clear the Enable background error checking check box.

References

Top Articles
What Is a Dairy-Free Diet?
Dairy-free diet: Pros, cons and how it works
Consignment Shops Milford Ct
Dippin Base Stat Total
The Girl Next Door | Rotten Tomatoes
T Mobile Rival Crossword Clue
What Is Carrier Default App? Everything You Need To Know - Mobile Soon
Craigslist In Lakeland
دانلود فیلم Toc Toc بدون سانسور
Rs3 Rituals
Tacos Diego Hugoton Ks
University Of Toledo Email
Family Guy Wiki Peter
Jennifer Paeyeneers Wikipedia
Stone Eater Bike Park
Descargar AI Video Editor - Size Reducer para PC - LDPlayer
Mogadore Reservoir Boat Rental Price
High school football: Photos from the top Week 3 games Friday
Appleton Post Crescent Today's Obituaries
Her Triplet Alphas Chapter 22
Storm Prediction Center Convective Outlook
Adopting Remote UniFi Devices with Windows Server DHCP – itramblings
Sweeterthanolives
Kira Kener 2022
Proctor Motors In Lampasas
Weather Arlington Radar
Sour Animal Strain Leafly
David Goggins Is A Fraud
Student Exploration Gravity Pitch
Eros Cherry Hill
How 'Tuesday' Brings Death to Life With Heart, Humor, and a Giant Bird
Cronología De Chelsea Contra Fulham
Brublackvip
100X35 Puerto Rico Meaning
Zip Tv Guide
Hotcopper Ixr
Pipa Mountain Hot Pot渝味晓宇重庆老火锅 Menu
Deborah Clearbranch Psychologist Georgia
Americas Cardroom Promo Code For Existing Users
From Iceland — Northern Comfort: A Turbulent Ride Of Comedy
Teamnet O'reilly Login
Galen Rupp Net Worth
Heatinghelp The Wall
Stihl Blowers For Sale Taunton Ma
10439 Gliding Eagle Way Land O Lakes Fl 34638
Rocky Aur Rani Kii Prem Kahaani - Movie Reviews
Craigslist Antelope Valley General For Sale
What Does Wmt Contactless Mean
Craig List El Paso Tx
Rs3 Spectral Spirit Shield
26200 E 64Th Ave
Craigslist Org Las Vegas Cars
Latest Posts
Article information

Author: Francesca Jacobs Ret

Last Updated:

Views: 5612

Rating: 4.8 / 5 (48 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Francesca Jacobs Ret

Birthday: 1996-12-09

Address: Apt. 141 1406 Mitch Summit, New Teganshire, UT 82655-0699

Phone: +2296092334654

Job: Technology Architect

Hobby: Snowboarding, Scouting, Foreign language learning, Dowsing, Baton twirling, Sculpting, Cabaret

Introduction: My name is Francesca Jacobs Ret, I am a innocent, super, beautiful, charming, lucky, gentle, clever person who loves writing and wants to share my knowledge and understanding with you.