“Reference isn’t Valid” Excel Error: How to Fix (2024)

When you’re working in Excel to organize and analyze your data, you may encounter different types of Excel errors ⚠️

Getting Excel errors is so frustrating because it hinders you from getting work done 😩

The “Reference isn’t Valid” error is one of the many Excel errors that you may encounter when you’re working on Pivot Tables.

But such an error can be fixed!

In this article, you’ll learn the three common reasons for the “Reference isn’t Valid” Excel error so you’ll know how to fix it 😀

Download this free practice workbook so we can work on it.

Problem #1: Reference to an invalid range

The most common reason for you to get the reference isn’t valid error is invalid references.

This can happen when the data reference has been deleted, moved, or renamed.

You can do these simple steps to check this.

  1. Open the attached Excel file. It has two sheets “Summary” and “Data”. A Pivot table is created on the Summary sheet. Pivot Table data refers to the data table in the “Data” sheet.
Open the attached Excel file.
  1. Go to the Pivot table Analyze tab and Refresh your data source reference. There will be no reference error and your Pivot Table is error-free.
Refresh data.
  1. Now, go to the Formulas tab and click the “Name manager” icon from the “Defined Names” group.
Opening the name manager
  1. You can see all the named ranges in this “Name Manager” window. In the current scenario, the data range of the data source reference is defined as “Packages”. Select that and click the “Edit…” button.
  1. Change the named range with a new name in the “Edit Name” dialog box. For example, you can change the “Packages” to “Sales”. Then, click the “OK” button. Close the name manager window also.
Change the defined range name
  1. Again, go to the Pivot table Analyze tab and refresh your data source reference. “Reference isn’t valid” error occurs for your Pivot Table.
Reference is not valid error message

This reference isn’t valid Excel error occurs as there is no valid range for the name range “Packages”. In other words. “Packages” is a non-existent range in this Excel file.

You can solve data source reference errors using one of the below methods.

  • Change the name of the named range to the original name. So, you can rename the entire range of data source references as “Packages”.
  • If you don’t choose rename, you can follow the below steps.
    1. Go to the Pivot Table Analyze tab and click “Change Data Source”.
    1. Delete the existing table name “Packages” from the Table/ Range box. Then, type the new table name “Sales” there.
Change the data source reference table name

Problem #2: Excel file is not on a local drive

Sometimes you get this error when the Excel file you are working on is not saved on your local drive 💻

You can follow the below steps to test this.

  1. Create a copy of the “Data” sheet to a new Excel file. You can right-click on the sheet name and select “Move or Copy…”.
Create a copy of data tables to a new Excel worksheet.
  1. Create a new Pivot Table on your file locally saved. This Pivot Table’s data source refers to the unsaved file. This unsaved Excel file is in a temporary folder.
Pivot Table data source - temporary file.
Create a new Pivot Table using the temporary Excel file.
  1. Then, close the new file with source data without saving it.
  2. Now, go to the Pivot Table Analyze tab and click “Change Data Source”.
  3. Click the “OK” button of the “Change Pivot Table Data Source” dialog box.
  4. You will get the “Data source reference is not valid” error message.
Data source reference is not valid

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.

Problem #3: Brackets in the file name

Sometimes the square brackets [ ] in the Excel file name also can be the reason for the “reference isn’t valid” Excel error message.

You can test this as follows.

  1. Insert square brackets for the file name before the .xlsx file.
Insert square brackets for the file name
  1. Now, try to create a new Pivot Table using data in the “Data” sheet.

Then, you will get the “Data source reference is not valid” error.

Data source reference is not valid

The reason is that Pivot Tables do not support predefined characters.

Square brackets are such characters. So, Pivot tables identify them as invalid characters or forbidden characters.

The solution in this current scenario is to remove square brackets from the file name.

  1. Go to the file explorer.
  2. Select the Excel file.
  3. Press F2
  4. Remove the square brackets of the file name.

That’s it – Now what?

Well done! Now, whenever Excel sends you the Reference isn’t valid excel error message, you already know what to do to fix it 😉

This reference error happens not only when working on Pivot tables. It can also happen in broken hyperlinks and What-if analysis formulas.

Thus, it’s really important to build formulas and function correctly.

Learn how to build advanced Excel functions that actually help you in your day-to-day work. Functions like the VLOOKUP, IF, and SUMIF.

Enroll in my 30-minute free online course here to learn these (and many more) in the most simple way possible 👍

Other resources

If you want to refresh your knowledge about Pivot Tables, don’t forget to read our article about How to Create a Pivot Table in Excel.

You can always refer to our article about the Full List of ALL Excel Errors and How to Fix Them when you encounter an Excel error.

Frequently asked questions

Most probably it can be due to one of the following.

  • Reference to an invalid range
  • The Excel file is not on a local drive
  • Square brackets in the file name