Correcting the Source Reference not Valid Error in a Pivot Table

When working with pivot tables, we sometimes encounter the error “Data source reference is not valid”.  

Figure 1.  “Data source reference is not valid” error message in Excel

Most probably, the reason for the error is one or more of the following:  

  • Excel file name contains the characters “ [ or “ ] ” or square brackets  
  • File comes from the email or on the web and is not saved in the local drive  
  • The pivot table data source refers to a non-existent range  
  • The data source refers to a named range with invalid reference  

Checklist to Correct the Source Reference Not Valid Error

 

  • Check the Excel file name.  If it contains any square brackets, rename the file and remove the brackets.  

 

Example:

Below is an example of a simple table with range B2:E6.  

When we try to insert a PivotTable, an error is displayed and the pivot table is not created.  

Figure 2.  Error in creating a pivot table

Rationale:

As shown, the file name is “[Correcting] the Source Reference not Valid Error in a Pivot Table.xlsx”. Note the square brackets in the word Correcting.  

Work-around:

Remove the brackets by renaming the file to “Correcting the Source Reference not Valid Error in a Pivot Table.xlsx”.

Figure 3.  Renaming the Excel file to remove square brackets

 

  • Save the Excel file to the computer or local drive.  

 

 

  • When inserting a pivot table with a named range, make sure the range exists and is defined.

 

Example:

Let’s use below data and create a pivot table.  

Figure 4.  Data for pivot table

Select cell G2, then click the Insert tab.  

Click PivotTable.

Figure 5.  Inserting a pivot table

In the Create PivotTable dialog box, enter “Data” into the Table/Range bar.

The “Data source reference is not valid.” error pops up.  

Figure 6.  Error in creating a pivot table with a named range

Rationale:

The error naturally exists because we tried to create a pivot table basing the values on the range “Data”, when in fact, the range does not exist  and is not defined.

Work-around:

We first define a named range before we use it to create a pivot table.  

Defining a Named Range

Step 1. Click the Formulas tab, then select Name Manager.

Figure 7.  Creating a named range using Name Manager

Step 2. In the Name Manager dialog box, click New.

Figure 8. Creating a new range

Step 3. Let us name the range “Data”.  Click the Refers to bar and select cells B2:E6 to define the range “Data”.

Figure 9.  Defining the named range

Figure 10.  Named range “Data” created

We have defined the range “Data”.  We can now successfully create a pivot table using this range.  

Figure 11.  Creating a pivot table with a named range

Figure 12.  Output: Pivot table created with the range “Data”

  • Ensure that  the reference for the named range is valid.  

 

Supposed we have a named range “Data”, but the reference is “=1”.  This will result to an error because a named range should refer to the cells whose values we want to analyze through a pivot table.  The value “1” does not return a valid range of values.

Figure 13.  Named range “Data” with invalid reference

  • Ensure no blank field names.  

The sample table below will result into an error because column E has a missing field name.  

Figure 14.  Source table with missing field name

  • Remove errors in any of the cells in the source data such as #VALUE!, #NAME?,  #REF.

Next time we encounter the “Source reference not Valid Error”, we only have to follow the checklist discussed in this article.  It will lead us to the quick correction of the error.

Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.

Our customers love us!
“The expert was absolutely amazing and stuck with me the whole way through. They were polite, patient, seemed to want to genuinely help me and provided a solution that I would never have managed otherwise. I could not be more thankful for their support and solution. Thank you!” - - Chris T, in California

Leave a Comment

avatar