VLOOKUP formula inside Table_array

scarlton

New Member
Joined
May 30, 2017
Messages
4
Hello,

I am trying to have vlookup search another sheet for a certain value. The problem is I want it to search the sheets in the table_array based on one of the other cells. I want it to look at what value I have in b9, so the formula is =VLOOKUP(DATE(P5,1,1),B9!$A$3:$F$2520,2,TRUE) but when I press enter, it opens my documents on my computer instead of referencing the cell b9. Is there a formula that I need to put into the table array portion to make it work, or is it something else?

Thanks in advance
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
=VLOOKUP(DATE(P5,1,1),INDIRECT(CHAR(39)&B9&“’!$A$3:$F$2520”),2,TRUE)

You have to use an INDIRECT cell reference, which is basically stringing together what you want the cell to look like. So this part of the above formula ...

INDIRECT(CHAR(39)&B9&“’!$A$3:$F$2520”)

... says, "Create a cell/range reference by stringing together a single quote plus whatever text is in cell B9 plus another single quote plus this cell range."

I could just as easily have done it this way:

INDIRECT("'"&B9&“’!$A$3:$F$2520”)

... but I think that placing a single quote between double quotes is hard to read; so I replaced the first instance with CHAR(39), which will return a single quote (character 39 on the ASCII table).
 
Upvote 0
Concisely put like this:

=VLOOKUP(DATE(P5,1,1),INDIRECT("'"&B9&"'!A3:F2520"),2,TRUE)

Note that you have set the match-type to TRUE. This implies that A3:F2520 is sorted in ascending order on column A. If this set up does not hold, replace TRUE with FALSE or just with 0.
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,843
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top