Use VLOOKUP with a Variable Table Name in Excel
Question details
Use a cell to select the table searched by an Excel VLOOKUP formula.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- The user wants to find a product in different tables without manually editing the table name in the formula.
- Observed behavior
- A table name entered in a cell determines the lookup range, and the returned value is multiplied by a quantity.
Check that each lookup table has product names in its first column and numeric values in its second column. Confirm the table names on the Table Design tab; Excel table names cannot contain spaces.
Select an Excel table with INDIRECT and VLOOKUP
Use this formula when a cell contains the name of the table to search.
Click each lookup table and open Table Design. Check its Table Name, such as Dairy or Veggies, and make sure the product and value columns are first and second.
Enter a valid table name in B4, a product name in C4, and a numeric quantity in D4.
In the result cell, enter =VLOOKUP(C4,INDIRECT(B4),2,FALSE)*D4. INDIRECT converts the name in B4 into a table reference, and VLOOKUP returns the matching value from column 2.
Change B4 to another existing table name, such as Veggies, to search that table without editing the formula.

Use a Variable Lookup Range in WPS Spreadsheets
Create named ranges for your product lists, then use VLOOKUP and INDIRECT to select a range by name and calculate the result.
- 1. Open the workbook: Open WPS Spreadsheets and choose Open to select your Excel workbook.
- 2. Name each lookup range: Select the product and value cells without the header row. Enter a name such as Dairy in the Name Box to the left of the formula bar and press Enter. Repeat for each lookup range.
- 3. Enter the inputs: Type a named range in B4, a product in C4, and a numeric quantity in D4.
- 4. Calculate the result: In the result cell, enter =VLOOKUP(C4,INDIRECT(B4),2,FALSE)*D4. Change B4 to another named range to search a different list.

Frequently Asked Questions
Why does the formula return #REF!?
Check B4 for extra spaces or a misspelled name, then click the table and check its name on Table Design. INDIRECT needs a valid table name or named range.
Why does VLOOKUP return #N/A?
Check that the product in C4 appears in the first column of the selected table. FALSE requires an exact match.
Can I use a named range instead of an Excel table?
Yes. Select the product and value cells, enter a valid name in the Name Box next to the formula bar, and use that name in B4.
How do I return the value without multiplying by quantity?
Remove the multiplication from the formula: =VLOOKUP(C4,INDIRECT(B4),2,FALSE).




