Office Products Excel 2010 Excel 2016 Excel 2013 Excel 2019 Excel for Microsoft 365 More…Less
Symptoms
When opening an Excel workbook that contains square brackets in the name (e.g., «foo[1]»), the user will receive the following error message when attempting to create PivotTables using data from within the workbook:
Data source reference is not valid
Cause
The cause is due to square brackets being invalid characters in an Excel workbook file name.
Resolution
This behavior is expected when these conditions occur. In order to work around this, the user would be required to remove all invalid Excel characters from the file name.
More Information
This issue may be seen when trying to open an Excel workbook from Internet Explorer. Internet Explorer creates a copy of the file in the temporary directory, renaming the file with square brackets. This can be avoided by clicking «Save,» instead of «Open,» when Internet Explorer presents the file to the user.
Need more help?
«Data source reference is not valid» is one annoying problem that can be hard to get rid of, if you don’t know the source problem. In this article, we will learn why data source isn’t valid occurs and how we can solve this annoying problem.
So, as the name suggests the error occurs when Excel tries to refer to location that is no longer available, invalid or doesn’t exist. Now this error can occur due to several reasons.
1: Pivot Tables Data Source Reference is Not Valid
So, when we create a pivot table it requires a data range. Using that data range excel creates the pivot reports. Now if you try to create pivot table with invalid range or refresh pivot table that refers to a range that no longer exists, this can cause «Reference is not valid error».
For example, here I have a data table, initially whose name was «Table1» but I change it to «data» later. Later I wanted to create a pivot table on this table.
So I went to insert —> Pivot tables. When it asked for the data source, I mentioned «Table1». This returns a «Data source reference is not valid» error. Because I do not have any range called «Table1» (I had changed it to «Data»).
So, this one of the main reasons for data reference invalid error.
How to solve Pivot Table Reference Error?
If you have several pivot tables in a workbook that refers to multiple ranges, named range or data tables, make sure that they refer to valid range. When you refresh pivot tables and this error occurs, it is possible that you have changed some range or names in the data mode. Check one by one each of them and save your excel file. This will solve reference error problem.
2: Named Ranges with #REF
The named ranges are great tools when it comes to managing structured data. But you got to be careful with the named ranges. When you name a given range, excel tags that specific name to the given range.
By default excel adjusts the named ranges when you delete or add rows to the named ranges. But if you delete entire range, the named range loses its reference. All the formulas, validations and condtional formatting depending on that range will not work. And if you try to copy that sheet or file you may get «reference is not valid» error.
How to solve named range «Reference invalid error».
To solve this error, use the shortcut CTRL+F3 shortcut. This will open the name manger. Check the names and there ranges. Delete or fix all the named ranges that refers to contains #REF!. Save your file. This will remove the «data source reference is not valid» error.
3: Table Name Change Caused Reference Not Valid Error.
Tables in Excel are great functionality. They help data management a lot. But they can cause the Reference errors to. It is similar to named ranges. When you use Table names in formulas, data validation, conditional formatting, and overtime when you delete or do some major changes to table, excel can through reference not valid error. This may not occur immediately but when you copy ranges or sheets to other workbooks or location.
How to avoid Table Caused Reference Error
To avoid such errors, you should check all the formulas, validations, conditional formatting that refers to table that has changed a lot earlier. Change or delete such formulas. This will solve the » Data Reference not Valid Error»
4: Referencing to Invalid Data Source
Excel has features of importing data from other sources. All these features can be accessed from data tab. «Get external Data», «Power Query», and «Power Pivot» are such examples. These features allow users to maintain data outside the Excel and import them whenever needed.
Now this feature is great but this cause problems when you accidentally or intentionally delete or move data source from the defined location. When the data source does not exist at the defined location, it is obvious that excel shows «Data source reference is not valid».
How to solve Data Source reference is not valid?
Check all the connections your file has. Check the connections to Access database if you have. Check it the location of the data source has changed. This is one of the main reasons of «Data source is not valid» Error. Even if you change the name of the data source, it can cause the error. You need to change the name in Excel connections too.
To solve this error, go to Data —> Get External Data —> Existing Connection. A window will open that will show the existing connection to the workbook. Check the connections and if you don’t need them anymore, remove them. If you do need them. Go to the location of the data source to check if that exist or not.
A lot of time, the connection is valid but file still throws a reference isn’t valid when excel refreshes data. It is possible that the query or table that you are trying to access from the database is changed or does not exist anymore. In that case, you will need to open the data base and check the queries thoroughly. You will find the route cause of the error here surely.
5: Macro Using Undefined Reference
If the error «excel reference isn’t valid» occurs when you run a macro than there can be a lot of reasons.
The first reason can be that macro references to a range that no longer exist in system. This can be easily solved by clicking on the debug method.
Other reason can be the database connection. If you are trying to access database from VBA and trying to run a query with a invalid connection or query than you may get this error. So you have to do all the things mentioned in previous step.
Other reason can be that you used an object whose reference is not added. Like if you want use active data object, you will need to add reference to that object first.
To add a reference to an object, open VBE using Alt+F11 key. Now go to tools in menu, click on References. It will open a dialog box that has all the available resource. Search the object you need. Check it and click OK button. This will add the reference to that object.
So yeah guys, these are the reasons and methods to solve the invalid data source error in Excel. I hope it was helpful. If you are still facing the difficulty removing this error, let me know in the comments section below. Till then keep Excelling.
Related Articles:
13 Methods of How to Speed Up Excel | Excel is fast enough to calculate 6.6 million formulas in 1 second in Ideal conditions with normal configuration PC. But sometimes we observe excel files doing calculation slower than snails. There are many reasons behind this slower performance. If we can Identify them, we can make our formulas calculate faster.
Center Excel Sheet Horizontally and Vertically on Excel Page : Microsoft Excel allows you to align worksheet on a page, you can change margins, specify custom margins, or center the worksheet horizontally or vertically on the page. Page margins are the blank spaces between the worksheet data and the edges of the printed page
Split a Cell Diagonally in Microsoft Excel 2016 : To split cells diagonally we use the cell formatting and insert a diagonally dividing line into the cell. This separates the cells diagonally visually.
How do I Insert a Check Mark in Excel 2016 : To insert a checkmark in Excel Cell we use the symbols in Excel. Set the fonts to wingdings and use the formula Char(252) to get the symbol of a check mark.
How to disable Scroll Lock in Excel : Arrow keys in excel move your cell up, down, Left & Right. But this feature is only applicable when Scroll Lock in Excel is disabled. Scroll Lock in Excel is used to scroll up, down, left & right your worksheet not the cell. So this article will help you how to check scroll lock status and how to disable it?
What to do If Excel Break Links Not Working : When we work with several excel files and use formula to get the work done, we intentionally or unintentionally create links between different files. Normal formula links can be easily broken by using break links option.
Popular Articles:
50 Excel Shortcuts to Increase Your Productivity | Get faster at your task. These 50 shortcuts will make you work even faster on Excel.
How to use Excel VLOOKUP Function| This is one of the most used and popular functions of excel that is used to lookup value from different ranges and sheets.
How to use the Excel COUNTIF Function| Count values with conditions using this amazing function. You don’t need to filter your data to count specific value. Countif function is essential to prepare your dashboard.
How to Use SUMIF Function in Excel | This is another dashboard essential function. This helps you sum up values on specific conditions.
Summary: This article helps you in exploring different ways to fix Excel Data source reference is not valid error. Apart from this, get complete detail on why you are getting this error and how to fix pivot table data source reference is not valid error.
Many Excel users are reporting there are encountering the “Data source reference is not valid” error while trying to create a Pivot table in Excel.
Commonly the issue appears while opening the Excel workbook that contains square brackets ([]) in the name and trying to create Pivot Tables by using data from within the workbook.
To extract data from corrupt Excel file, we recommend this tool:
This software will prevent Excel workbook data such as BI data, financial reports & other analytical information from corruption and data loss. With this software you can rebuild corrupt Excel files and restore every single visual representation & dataset to its original, intact state in 3 easy steps:
- Download Excel File Repair Tool rated Excellent by Softpedia, Softonic & CNET.
- Select the corrupt Excel file (XLS, XLSX) & click Repair to initiate the repair process.
- Preview the repaired files and click Save File to save the files at desired location.
Practical Scenario:
Well, this is a very irritating error but is common as it is not limited to any particular Excel version. Let describe Excel data source reference is not valid error best with the user personal experience.
Recently, I have been getting this error message when I try to create a Pivot Table from Table in excel 2007. I have checked every single column and there is no empty one. I am really getting annoyed as the same data which have imported from CRM system sometimes work and other times does not work. If I also convert my data in to a range and try to insert PT, I get the same error.
Please help!
Posted in AccountingWEB community…
Anyways this is not something that can’t be fixed, check out the possible fixes to troubleshoot pivot table data source reference is not valid error.
But before moving further, know what is causing Data source reference is not valid error in Excel.
Why I Am Getting The “Data Source Reference Is Not Valid” Error In Excel?
Well, the most common cause of the error is the square brackets (invalid characters) in the Excel workbook file name.
However, it is investigated despite this there are several other culprits as well that trigger data source reference is not a valid error message.
Here check them out:
1: Excel file not saved on the local drive –
If you are trying to create a Pivot Table from an Excel file opened directly from the website or an email attachment then you may encounter the particular error message. As in this case, the file will open from the temporary folder and this won’t have the same permissions as a regular folder.
If you are having the related scenario then resolve the Excel data source reference not a valid error by saving the file on the local drive first.
2: The pivot table data refers to a non-existent range –
If the range is not defined properly then this what caused the particular error. And you are trying to create a Pivot table with an undefined range then the same error appears. And to fix the error define the range before trying to create the Pivot table.
3: The data source refers to a named range that contains invalid references –
This is another possible reason responsible for the Data source reference is not valid error. Well, if the range is defined but references to invalid values, the error crop up. So to fix it make use of the Name Manager to identify the values referenced and other necessary modifications to troubleshoot the problem.
4: Excel file name contains square brackets –
Well, I discussed it earlier, if the name in Excel workbook contains square brackets then pivot table data source reference is not the valid error appears. Despite this there set of prohibited characters that Pivot tables won’t support. So to fix this Pivot table issue, edit the file name and remove square brackets and other forbidden characters.
So, these are some of the common reasons why you are getting the data reference is not a valid error in Excel. Now to resolve the error message, check out the possible fixes worked for the users to encounter a similar situation.
Make sure to follow the fixes in the order they are presented.
Here are the following fixes which you need to try for fixing up this Excel data source reference is not valid error.
1# Remove File name Brackets
2# Saving file on the Local Disk
3# Assure the Range Exists and is Defined
4# Assure the reference for Named Range is Valid
5# Utilize Excel File Recovery Tool
Let’s discuss all these fixes briefly….!
Fix 1# Remove File Name Brackets
As discussed above this is the most common reason that triggers the pivot table data source reference is not valid error.
So, while creating a Pivot Table make sure the file won’t contain the forbidden characters. Apart from this check out the steps to modify the name of the XLSX or XLS file for removing the prohibited characters.
Follow the steps to do so:
- Close the Excel window currently using the file.
- Now utilize File Explorer to locate the Excel file location > and as you go there> right-click on it > select Rename.
- And remove brackets from the file name and try recreating the Pivot table again.
Hope this works for you to fix the reference is not a valid Excel pivot table, but if still the error is not resolved then follow the next solution.
Don’t Miss: Ways to Repair MS Excel Pivot Table Corruption
Fix 2# Saving File On The Local Disk
You can also encounter the error if opening the file directly from the website or from an email attachment. And in this case, the file opened from a temporary file that at the end cause the Data source reference is not valid error.
Now, to resolve the issue save the Excel file to the local drive. And before creating the Pivot Table, go to File > Save as and save the file on the local drive.
As the file is saved, follow the steps that were causing the Data source reference is not valid error earlier.
It is estimated, you can now recreate the Pivots table without encountering the error.
Fix 3# Assure The Range Exists And Is Defined
If you are trying to insert Pivot Table in a non-existing or not defined range then this is another reason guilty for Excel data source reference is not valid error.
Let describe it best by creating a scenario, you are trying to create PivotTable, you will go to Insert PivotTable > select the toggle related with Select a table or range and set Table/Range to ‘test’.
And, if you have based the values on ‘test’ range and it won’t exist, you would encounter the “Data source reference is not valid” error just after clicking OK
However, if dealing with the same scenario then follow the below-given steps to fix the Excel error
Follow the steps to do so:
- From the ribbon bar click the Formulas tab > click on Name Manager.
- Now inside the Name Manager Window click on New > name the range you will create. And use the Refers to the box for setting the cells you desire to use for the range. You can type it yourself or utilize a built-in selector
- Now the range is defined, you can create the Pivot table without getting the error.
Hope after defining a range before trying to create a Pivot table, you can fix the pivot table data source reference is not valid Excel error.
Fix 4# Assure The Reference For Named Range Is Valid
Well, if after defining the range you are still getting the data source reference is not valid error, then the chances are you are getting the error message because the named range is referring to some cells whose values are not valid.
To correct this simply go to Formulas > Name Manager and check if the range is referring to the cells that you need to analyze through the pivot table. Well, if you identify any conflicts > then use the Refer to box to make the switch to the correct value.
And as the modifications are made, try to create a Pivot Table again and check if the Excel data source reference is not the valid error is fixed or not.
I Hope, the given solutions will work for you to fix the Excel data source reference is not valid error.
Fix 5# Utilize Excel File Recovery Tool
Chances are also that due to the occurrence of corruption issue in the Excel pivot table you are getting this data source reference is not valid error. So if the above fixes fail to resolve the issue then try the Excel Recovery Tool to fix any type of corruption issue that occurred in the pivot table.
This is an advanced repair tool that allows repairing corrupted, damaged, inaccessible Excel files and some sort of errors in Excel. Not only this also recover the lost, deleted, corrupted Excel file data without any modification.
You can recover chart, chart sheet, table, cell comment, image, cell comment, formula, and sort & filter, and all data components from corrupt Excel files. It is easy to use and supports all Excel versions.
* Free version of the product only previews recoverable data.
Steps to Utilize Excel Recovery Tool:
Now It’s Your Turn:
So, this is all about the Excel data source reference is not valid error. I tried my best to put together the working solutions to fix the error.
Make use of the given solutions one by one to fix the error and start creating a Pivot Table without any error.
Hope the article helped you to solve all your queries. You can read one of our previous articles related to the Excel Pivot table issue PivotTable Field Name is not valid.
Despite this, I love to hear from you, feel free to share your valuable comments, queries, suggestions in the below comment section.
Good Luck….
Priyanka is an entrepreneur & content marketing expert. She writes tech blogs and has expertise in MS Office, Excel, and other tech subjects. Her distinctive art of presenting tech information in the easy-to-understand language is very impressive. When not writing, she loves unplanned travels.
Have you ever experienced a Data source reference isn’t valid Excel error?
It often happens while you are in the process of making a pivot table from a range in Excel. Not only the Excel version but OS users also tend to witness this Excel error.
So basically, what is the reason behind this error? Do you have any idea? Every time there is a cause and effect relation between two variables. The same is the case with Data source reference isn’t valid Excel error and reason behind this error.
The Reasons behind the Data Source Reference isn’t Valid Excel Error
Not a single reason, in fact, there are multiple triggers that let you face this error. After analyzing the nature of this error and the steps being taken to solve it, the ultimate upshot clears that several reasons fall behind this storyline. Let’s have a look:
- Excel File Name has Square Brackets
In Pivot tables, some of the predefined characters are not allowed to use. One of the greatest reasons why data source reference isn’t valid Excel error appears is the presence of “[‘or’]”. In that case, you simply need to rename the file name and remove the brackets.
- Excel File isn’t on the Local Drive
It might be possible that you have not saved the pivot table on your local drive. When you open a pivot table directly from the website or online, you may find this error. It is because your file does not have required access because it is a temporary folder excluding all the permissions as other folders. Saving the folder on the local drive can resolve the issue.
- The Pivot Table Data Refers to a Non-Existent Range
Do you know having an improper range can be a reason behind this error? In case, if you are making a pivot table with a non-existent range, you will surely have to face this error. By defining the range, you can get rid of this problem.
- The Data Source Refers to a Named Range that has Invalid References
Here is another potential cause behind this error. Using the Name Manager to spot the values and executing the process of vital changes can help you solve this error.
Apart from these reasons, there can be some other causes as well. If you are in need to get rid of this error permanently, we are here for you. We have many more solutions to your Data source reference isn’t valid Excel error. Follow the tricks given below for the best results and you have to be stick to a single fix to solve the error.
We are going to explain each solution in detail with complete steps.
Let’s dive in:
Trick 1: Removing Brackets from the File Name
Incorrect file names can be one of the biggest reasons to show errors. As you already know this error can be gone by just renaming the file name. If your reports are auto-generated, it might be possible that your file name contains forbidden characters including square brackets [ ], you will surely find this error while creating a pivot table.
Renaming the name of the .xlsx file to remove unwanted characters is the solution to it. Follow the steps:
- If your file is in use, you have to close it to rename the file.
- Using File Explorer, you can navigate the location of the Excel file. After reaching there, you have to right-click on it and choose Rename.
- Remove brackets from the file name because the pivot table does not support such characters.
- Now, try creating the Pivot table once again and check if the Data source reference isn’t valid Excel error still exists or not.
If the error is solved you are done. However, if you are still having issues, it means this solution is not suitable for the scenario. You need to move forward to check the next method.
Trick 2: Saving the File on the Local Drive
Opening a file directly from the website or email attachment can put you in trouble. You will be in Read-only mode while doing this. To edit the file, you need to save it in your system. It can be a potential reason behind this error. Follow the steps given below to find a perfect solution:
- Go to File and then choose Save As option.
- Choosing the Save As option will let you save the file on your local disk.
- Once the file is saved on your local drive, your file will be error-free. For further satisfaction, you can check the pivot table if the Data source reference isn’t valid Excel error still appears or not.
Again, if this method is not successful for you, don’t worry about it.
For the current scenario, this method was not applicable, that’s why you need to move on to the next solution.
Trick 3: Predefined Range Existence
Unlike other reasons, this cause is a bit tricky to understand. While trying to add a pivot table in a non-existing range, you may stumble upon this reference error.
To get rid of this problem, you need to follow the steps given below:
- Go to Insert PivotTable and choose the toggle linked with Select a table or range.
- Now, set the Table/Range to “test”.
If your values are based on the “test” range, which isn’t there, then surely you will encounter the Data source reference isn’t valid Excel error right after pressing the OK button.
If this is the case, you can work on it by defining a range before making a pivot table. Here is how you can do this:
- Click the Formulas tab that appeared on the ribbon bar.
- Choose the Name Manager given in the list.
- In the Name Manager window, select New and name the range you wanted to create.
- Now, use the Refers to box to set the cells reserved for the range.
- Now the range is well-defined and you can easily make pivot tables without facing the error message.
Move down to the next solution, if you are still encountering the same issue even after trying all the above-mentioned solutions.
Trick 4: Reference for the Named Range is Valid or Not
After successfully defining the name range, if you still getting an error message, it might be possible that the named range is referring to some cells whose values are not valid.
To sort out this problem, follow the steps given below:
- Go to the Formulas tab and open Name Manager.
- Now, check if the range is referring to the cells that are reserved to analyze through the pivot table.
- Use the Refer to box, in case you witness any variations to make the switch to the correct value.
Once you are done with all the changes, try making a pivot table again and check if the Data source reference isn’t valid Excel error still appears or not.
Excel triggers the “..Reference isn’t Valid” error when it cannot locate the cell or range you referenced. While this normally is the case, you will also run into this issue if your Excel file name includes invalid characters.
You may encounter the reference error while creating Pivot Tables, Text boxes or dealing with broken hyperlinks in the Excel program. While you could exit the error message and enter correct references, in some cases this is not possible as all options in the ribbon get grayed out.
Before heading to the fixes, check if your reference is listed as broken or missing. You can check your reference from the Visual Basic for Application (Alt + F11) window. Head to Tools > References.
Exit Design Mode
Many users stumble on this error while creating a text box from the Developer tab. All the ribbon items get grayed out after Excel displays the alert. While you can move between all tabs, you cannot open the File tab.
Even though this error seems out of the blue, it is actually because of a minor human error. When you insert the text box, you must exit the Design mode before you start entering data into the box. However, if you enter your value before exiting the Design mode, you will actually enter your data in the formula bar.
The formula bar initially contains the formula referencing the location of the text box in the grid. When you enter a value that does not refer to a location, Excel will trigger the Reference Isn’t Valid error.
- Click the OK button in the warning message box.
- Select Cancel (X) next to the formula bar.
- From the Developer tab, deselect Design Mode.
Referred Cell Does Not Include Formula: Goal Seek
If you run into this error while using Goal Seek (VBA or What-if analysis), it may be because one of the cells you referred to as Set Cell doesn’t hold a formula. You will also get this alert if you’ve entered a formula instead of a value in the By Changing cell.
To fix this issue, check if you’ve embedded formulas in all cells in the Set Cell range. Additionally, verify that your By Changing cell holds a numeric value, not a formula. After making these changes, run the command again.
Change Pivot Table Named Range
You may have entered an invalid named range while creating a pivot table in Excel. When creating a Pivot Table, you need to enter the cell or named range that exists in the grid.
You must have made a typo while referring to a named cell range, causing Excel to fail to locate your range to create a Pivot Table. Verify your named range from the Name Manager before you create a Pivot Table.
Create a new PivotTable to change your named range.
- Open your worksheet.
- Head to Insert > PivotTable.
- Enter a valid named range in the Table/Range section.
Rename File
You will encounter the Data source reference is not valid error message if your file name has squared brackets. Excel cannot take references from your worksheet if your username contains this special character. Therefore, you cannot perform actions such as creating Pivot Tables that need to take your current worksheet as a reference.
You need to remove the squared bracket from your file name to solve this error.
- Open File Explorer to locate your document.
- Right-click on your Excel file, then click F2.
- Erase the squared brackets from your file name and hit Enter.
Remove Hyperlinks
You could also be dealing with broken hyperlinks if you receive the reference isn’t valid error. The file you linked could be missing or corrupt, making your reference invalid.
You can work around this issue by removing the problematic hyperlinks from your worksheet. If you do not know which hyperlink may be causing this issue, your best bet is to remove all existing hyperlinks.
- Launch your Worksheet.
- Locate the hyperlink from your sheet, then right-click on it.
- Choose Remove hyperlink.
Save the File
Excel may also trigger this error if you try to make changes in an Excel file that isn’t stored on your computer. If you cannot save the document, the creator of the document may have not given you adequate permission.
Check if your file is currently running on Read-Only mode. If you haven’t saved the file locally, use Ctrl + S to save it to your device.