Fix #REF! Errors in Excel Dynamic Sheet Name Formulas
Question details
The user needs to use a dynamic list of vendor worksheet names in an Excel formula without generating #REF! errors.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A SUMPRODUCT and SUMIF formula uses INDIRECT to build references from a vendor worksheet list.
- Observed behavior
- The dynamic structured reference returns #REF!, while a static named range works.
Check that each entry in the Vendor Worksheet column exactly matches an existing worksheet tab. Identify the cell containing your SUMIF criterion and confirm that the ranges to be matched and summed have the same dimensions.
Calculate each vendor total in a helper column
Use one worksheet name per table row so INDIRECT builds a valid reference for each vendor.
The failing formula can turn the literal structured reference into a worksheet name, producing an invalid reference such as 'Vendor_Table[[#All],[Vendor Worksheet]]'!C3. Instead, use the value from each table row to construct a reference such as 'Vendor Sheet'!C3.
The example below assumes the criterion is in H1, each vendor sheet has criteria in C3:C100 and amounts in F3:F100, and the table is named Vendor_Table. Adjust these references to match your workbook.
In Vendor_Table, inspect the Vendor Worksheet column and correct any names that do not match the worksheet tabs. Remove blank entries or exclude them from the calculation.
Add a column named Vendor Total to Vendor_Table. In its first data row, enter =SUMIF(INDIRECT("'"&SUBSTITUTE([@[Vendor Worksheet]],"'","''")&"'!C3:C100"),$H$1,INDIRECT("'"&SUBSTITUTE([@[Vendor Worksheet]],"'","''")&"'!F3:F100")).
Confirm the formula fills the Vendor Total column for every vendor. In a cell outside the table, enter =SUM(Vendor_Table[Vendor Total]) to combine the results.
If a row still shows #REF!, compare its Vendor Worksheet value with the corresponding sheet tab and verify that the sheet exists in the workbook.

Calculate vendor totals in WPS Spreadsheet
Use INDIRECT and SUMIF with a helper column in WPS Spreadsheet to calculate totals from a list of vendor worksheet names.
- 1. Open the workbook: Open the Excel workbook in WPS Spreadsheet and select the summary sheet.
- 2. Set up the list: Enter the SUMIF criterion in H1 and list the exact vendor sheet names in B2 and the cells below it.
- 3. Calculate each total: In C2, enter =SUMIF(INDIRECT("'"&SUBSTITUTE(B2,"'","''")&"'!C3:C100"),$H$1,INDIRECT("'"&SUBSTITUTE(B2,"'","''")&"'!F3:F100")), then fill the formula down beside the vendor names. Adjust the criterion and ranges to match your workbook.
- 4. Sum the vendor results: In an empty cell, enter a SUM formula covering the results in column C, such as =SUM(C2:C10), and adjust the final row to fit your list.

Frequently Asked Questions
Why does INDIRECT return #REF! for my vendor table?
The formula may be treating the structured-reference text itself as a worksheet name. Use the actual sheet name from each table row to build a reference such as 'Vendor Sheet'!C3.
How do I handle a sheet name that contains an apostrophe?
Use SUBSTITUTE on the sheet name to double each apostrophe before building the INDIRECT reference, as in SUBSTITUTE(B2,"'","''"). Enclose the resulting sheet name in single quotes.
Can I use different ranges in the SUMIF formula?
Yes. Replace C3:C100 and F3:F100 with your criteria and sum ranges, respectively. Make sure the two ranges have the same dimensions on every vendor sheet.
What should I check if only one vendor row returns #REF!?
Compare that row's vendor name with its worksheet tab, including spaces and punctuation. Also confirm that the worksheet has not been renamed or deleted.




