Function Problems

Use VLOOKUP with a Variable Table Name in Excel

Huma Ashraf ChHuma Ashraf Ch Dec 2, 2026 868 views

Question details

Use a cell to select the table searched by an Excel VLOOKUP formula.

How to Use VLOOKUP with a Variable Table Name in Excel
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.
Before you start

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.

Solution 1Recommended

Select an Excel table with INDIRECT and VLOOKUP

Use this formula when a cell contains the name of the table to search.

1
Check the table names

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.

2
Enter the lookup inputs

Enter a valid table name in B4, a product name in C4, and a numeric quantity in D4.

3
Enter the formula

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.

4
Switch tables

Change B4 to another existing table name, such as Veggies, to search that table without editing the formula.

Select an Excel table with INDIRECT and VLOOKUP
Check errors: A #REF! error can mean B4 does not contain a valid table name. A #N/A error means the product was not found in the selected table's first column.
WPS Spreadsheets

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. 1. Open the workbook: Open WPS Spreadsheets and choose Open to select your Excel workbook.
  2. 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. 3. Enter the inputs: Type a named range in B4, a product in C4, and a numeric quantity in D4.
  4. 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.
Switch product lookup ranges by changing a cellOpen and edit Microsoft Excel XLSX filesUse familiar spreadsheet formulas and a familiar interfaceUse WPS Office for free
microsoft office alternative - wps office

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).