Function Problems

Use a Variable Sheet Name in an Excel VLOOKUP Formula

Steven ParkerSteven Parker Nov 25, 2026 870 views

Question details

Use a sheet name stored in a cell as part of an Excel VLOOKUP reference.

Use a Variable Sheet Name in an Excel VLOOKUP Formula
Product
Microsoft Excel
Device & OS
not provided
Scenario
The user wants to switch a lookup between worksheets by changing the sheet name in a cell.
Observed behavior
The lookup should read the specified worksheet and return a matching value from its data range.
Before you start

Check that each data worksheet has lookup values in column A and return data within A3:D136. Confirm that the sheet name cell matches an existing worksheet and that the return-column number is between 1 and 4.

Solution 1Recommended

Combine VLOOKUP and INDIRECT to Reference a Sheet Name

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

INDIRECT converts the sheet name and range into a reference that VLOOKUP can search. Single quotes around the sheet name allow names containing spaces.

1
Enter the sheet name

In cell B17, type the exact name of the worksheet containing the lookup data, such as Sales Data.

2
Set the lookup inputs

Enter the value to find in A18. Enter a return-column number from 1 to 4 in E5; for example, enter 2 to return a value from column B.

3
Enter the formula

Select the cell where you want the result and enter =VLOOKUP($A18,INDIRECT("'"&$B17&"'!$A$3:$D$136"),E$5,FALSE). Press Enter.

4
Switch worksheets

Change the sheet name in B17 to another existing worksheet name. The formula will search that worksheet's A3:D136 range.

Combine VLOOKUP and INDIRECT to Reference a Sheet Name
Sheet names containing apostrophes: If a sheet name contains an apostrophe, replace $B17 in the INDIRECT expression with SUBSTITUTE($B17,"'","''") so the reference is interpreted correctly.
Work with dynamic lookups

Create a Dynamic Sheet Lookup in WPS Spreadsheets

Use VLOOKUP and INDIRECT in WPS Spreadsheets to search a worksheet named in a cell and change the source without rewriting the formula.

  1. 1. Open the workbook: Open WPS Spreadsheets and use Open to select your Excel workbook.
  2. 2. Enter the inputs: Type the source worksheet name in B17, the lookup value in A18, and a return-column number from 1 to 4 in E5.
  3. 3. Add the lookup formula: Select the result cell and enter =VLOOKUP($A18,INDIRECT("'"&$B17&"'!$A$3:$D$136"),E$5,FALSE), then press Enter.
  4. 4. Change the source sheet: Edit B17 to another existing worksheet name to look up data in that sheet's A3:D136 range.
Switch the lookup worksheet by editing one cellUse familiar VLOOKUP and INDIRECT formulasOpen and edit Microsoft Excel XLSX and XLS filesWork in a familiar spreadsheet interface
QA img-9

Frequently Asked Questions

Why does the formula return #REF!?

Check that B17 matches an existing worksheet name and that the referenced range is valid. If the sheet name contains an apostrophe, use SUBSTITUTE($B17,"'","''") in the INDIRECT expression.

Why does VLOOKUP return #N/A?

With FALSE as the last argument, VLOOKUP requires an exact match. Check that A18 appears in column A of the selected sheet's A3:D136 range and that the values have matching data types.

Do I need quotes around every sheet name?

Single quotes are needed for names with spaces and are safe to use for ordinary names. If the name has no spaces, INDIRECT($B17&"!$A$3:$D$136") also works.

Can I put the lookup range in a separate cell?

Yes. For example, put $A$3:$D$136 in C17 and use =VLOOKUP($A18,INDIRECT("'"&$B17&"'!"&$C$17),E$5,FALSE). The text in C17 must be a valid range reference.