Solved

Dynamic Vlookup Function Formula Help

Posted on 2016-11-30
4
41 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
  • 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 21

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

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

860 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