Solved

Dynamic Vlookup Function Formula Help

Posted on 2016-11-30
4
48 Views
Last Modified: 2016-11-30
I have the following formula which is not working.

So I am trying to assign the vlookup array location dynamically. I think I am having a problem with the worksheet name (PNL) in this case.

=VLOOKUP(B11,"'PNL'!A"&VLOOKUP(B1,$A$31:$C$45,2,FALSE)& ":N"&VLOOKUP(B1,$A$31:$C$45,3,FALSE),4,FALSE)

When I evaluate the formula, It shows Vlookup("XLF","'PNL'!A14:N38",4,False) and then it gives #Value!

The vlookup function that I create manually work fine (=VLOOKUP(B11,'PNL'!$A$14:$N$38,4,FALSE)), so the data is there. But my dynamic formula doesn't work. I think the problem is with the name of the spreadsheet. Or maybe something else?
0
Comment
Question by:awesomejohn19
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 7

Expert Comment

by:Mike in IT
ID: 41907570
First off, this part of your dynamic vlookup has to return a number VLOOKUP(B1,$A$31:$C$45,2,FALSE). Then you should try CONCATENATE to put it all together like this:

=VLOOKUP(B11,CONCATENATE("'PNL'!$A",VLOOKUP(B1,$A$31:$C$45,2,FALSE),":N",VLOOKUP(B1,$A$31:$C$45,3,FALSE)),4,FALSE)

Open in new window


I can't test it very well, but it works for me like that.
0
 

Author Comment

by:awesomejohn19
ID: 41907583
Hi Michael , when I put your version it brings the following when I do the Evaluate formula

Vlookup("XLF","'PNL!$A14:N38",4,FALSE)

But is still results #VALUE!
0
 
LVL 22

Accepted Solution

by:
Ejgil Hedegaard earned 500 total points
ID: 41907620
"'PNL'!A14:N38" is a text, not a range.
To convert to a range, use the indirect function.
So the formula must be

=VLOOKUP(B11,INDIRECT("'PNL'!A"&VLOOKUP(B1,$A$31:$C$45,2,FALSE)& ":N"&VLOOKUP(B1,$A$31:$C$45,3,FALSE)),4,FALSE)
0
 

Author Closing Comment

by:awesomejohn19
ID: 41907628
Excellent
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question